From 6ef9404ee90aec157287c6f661e86c3a4dbd65d3 Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Sat, 26 Dec 2020 15:57:25 +0800 Subject: [PATCH] fix: drawer handle slot trigger twice click event --- components/vc-drawer/src/Drawer.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/vc-drawer/src/Drawer.js b/components/vc-drawer/src/Drawer.js index c66d76d91..f12bda4a0 100644 --- a/components/vc-drawer/src/Drawer.js +++ b/components/vc-drawer/src/Drawer.js @@ -1,5 +1,5 @@ import classnames from '../../_util/classNames'; -import { cloneVNode, Teleport, nextTick, defineComponent } from 'vue'; +import { Teleport, nextTick, defineComponent } from 'vue'; import BaseMixin from '../../_util/BaseMixin'; import { initDefaultProps, getSlot } from '../../_util/props-util'; import getScrollBarSize from '../../_util/getScrollBarSize'; @@ -15,6 +15,7 @@ import { isNumeric, } from './utils'; import supportsPassive from '../../_util/supportsPassive'; +import { cloneElement } from 'ant-design-vue/es/_util/vnode'; function noop() {} @@ -417,9 +418,9 @@ const Drawer = defineComponent({ const { handler: handlerSlot } = this; const handlerSlotVnode = handlerSlot || handlerDefalut; const handleIconClick = handlerSlotVnode.props && handlerSlotVnode.props.onClick; - handlerChildren = cloneVNode(handlerSlotVnode, { + handlerChildren = cloneElement(handlerSlotVnode, { onClick: e => { - handleIconClick && handleIconClick(); + handleIconClick && handleIconClick(e); this.onIconTouchEnd(e); }, ref: c => {