Skip to content

Commit

Permalink
fix(dropdown): icon and trigger work unexpected
Browse files Browse the repository at this point in the history
修复Dropdown中popconfirm的事件响应区域以及icon不正常的问题

fix: #796,#787
  • Loading branch information
mynetfan committed Jun 23, 2021
1 parent 9298b3c commit 60b80c9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/components/Dropdown/src/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
@click="handleClickMenu(item)"
:disabled="item.disabled"
>
<Popconfirm v-if="popconfirm && item.popConfirm" v-bind="item">
<Icon :icon="item.icon" v-if="item.icon" />
<span class="ml-1">{{ item.text }}</span>
<Popconfirm v-if="popconfirm && item.popConfirm" v-bind="omit(item.popConfirm, 'icon')">
<template #icon v-if="item.popConfirm.icon">
<Icon :icon="item.popConfirm.icon" />
</template>
<div>
<Icon :icon="item.icon" v-if="item.icon" />
<span class="ml-1">{{ item.text }}</span>
</div>
</Popconfirm>
<template v-else>
<Icon :icon="item.icon" v-if="item.icon" />
Expand All @@ -34,6 +39,7 @@
import { defineComponent } from 'vue';
import { Dropdown, Menu, Popconfirm } from 'ant-design-vue';
import { Icon } from '/@/components/Icon';
import { omit } from 'lodash-es';
export default defineComponent({
name: 'BasicDropdown',
Expand Down Expand Up @@ -78,6 +84,7 @@
return {
handleClickMenu,
omit,
getAttr: (key: string | number) => ({ key }),
};
},
Expand Down

0 comments on commit 60b80c9

Please sign in to comment.