fix(pop-confirm): fix event working unexpected
This commit is contained in:
parent
4d8e39857e
commit
a6ef771fcc
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
- **Table** 修复分页抖动问题
|
- **Table** 修复分页抖动问题
|
||||||
- **Upload** 确保携带自定义参数
|
- **Upload** 确保携带自定义参数
|
||||||
|
- **Dropdown** 修复 popConfirm 的图标显示问题
|
||||||
|
|
||||||
## 2.5.0(2021-06-20)
|
## 2.5.0(2021-06-20)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,10 @@
|
||||||
@click="handleClickMenu(item)"
|
@click="handleClickMenu(item)"
|
||||||
:disabled="item.disabled"
|
:disabled="item.disabled"
|
||||||
>
|
>
|
||||||
<Popconfirm v-if="popconfirm && item.popConfirm" v-bind="omit(item.popConfirm, 'icon')">
|
<Popconfirm
|
||||||
|
v-if="popconfirm && item.popConfirm"
|
||||||
|
v-bind="getPopConfirmAttrs(item.popConfirm)"
|
||||||
|
>
|
||||||
<template #icon v-if="item.popConfirm.icon">
|
<template #icon v-if="item.popConfirm.icon">
|
||||||
<Icon :icon="item.popConfirm.icon" />
|
<Icon :icon="item.popConfirm.icon" />
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -33,13 +36,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { PropType } from 'vue';
|
import { computed, PropType } from 'vue';
|
||||||
import type { DropMenu } from './typing';
|
import type { DropMenu } from './typing';
|
||||||
|
|
||||||
import { defineComponent } from 'vue';
|
import { defineComponent } from 'vue';
|
||||||
import { Dropdown, Menu, Popconfirm } from 'ant-design-vue';
|
import { Dropdown, Menu, Popconfirm } from 'ant-design-vue';
|
||||||
import { Icon } from '/@/components/Icon';
|
import { Icon } from '/@/components/Icon';
|
||||||
import { omit } from 'lodash-es';
|
import { omit } from 'lodash-es';
|
||||||
|
import { isFunction } from '/@/utils/is';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'BasicDropdown',
|
name: 'BasicDropdown',
|
||||||
|
|
@ -82,9 +86,20 @@
|
||||||
item.onClick?.();
|
item.onClick?.();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPopConfirmAttrs = computed(() => {
|
||||||
|
return (attrs) => {
|
||||||
|
const originAttrs = omit(attrs, ['confirm', 'cancel', 'icon']);
|
||||||
|
if (!attrs.onConfirm && attrs.confirm && isFunction(attrs.confirm))
|
||||||
|
originAttrs['onConfirm'] = attrs.confirm;
|
||||||
|
if (!attrs.onCancel && attrs.cancel && isFunction(attrs.cancel))
|
||||||
|
originAttrs['onCancel'] = attrs.cancel;
|
||||||
|
return originAttrs;
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
handleClickMenu,
|
handleClickMenu,
|
||||||
omit,
|
getPopConfirmAttrs,
|
||||||
getAttr: (key: string | number) => ({ key }),
|
getAttr: (key: string | number) => ({ key }),
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue