Commit 60b80c96e82da9101d56b2e195e9e7571de11f0a

Authored by 无木
1 parent 9298b3c9

fix(dropdown): icon and trigger work unexpected

修复Dropdown中popconfirm的事件响应区域以及icon不正常的问题

fix: #796,#787
src/components/Dropdown/src/Dropdown.vue
... ... @@ -11,9 +11,14 @@
11 11 @click="handleClickMenu(item)"
12 12 :disabled="item.disabled"
13 13 >
14   - <Popconfirm v-if="popconfirm && item.popConfirm" v-bind="item">
15   - <Icon :icon="item.icon" v-if="item.icon" />
16   - <span class="ml-1">{{ item.text }}</span>
  14 + <Popconfirm v-if="popconfirm && item.popConfirm" v-bind="omit(item.popConfirm, 'icon')">
  15 + <template #icon v-if="item.popConfirm.icon">
  16 + <Icon :icon="item.popConfirm.icon" />
  17 + </template>
  18 + <div>
  19 + <Icon :icon="item.icon" v-if="item.icon" />
  20 + <span class="ml-1">{{ item.text }}</span>
  21 + </div>
17 22 </Popconfirm>
18 23 <template v-else>
19 24 <Icon :icon="item.icon" v-if="item.icon" />
... ... @@ -34,6 +39,7 @@
34 39 import { defineComponent } from 'vue';
35 40 import { Dropdown, Menu, Popconfirm } from 'ant-design-vue';
36 41 import { Icon } from '/@/components/Icon';
  42 + import { omit } from 'lodash-es';
37 43  
38 44 export default defineComponent({
39 45 name: 'BasicDropdown',
... ... @@ -78,6 +84,7 @@
78 84  
79 85 return {
80 86 handleClickMenu,
  87 + omit,
81 88 getAttr: (key: string | number) => ({ key }),
82 89 };
83 90 },
... ...