From 910a62eb4a6ba1541b1ba3c01427a0b17602a621 Mon Sep 17 00:00:00 2001 From: tanjinzhou <415800467@qq.com> Date: Thu, 21 Nov 2019 10:49:41 +0000 Subject: [PATCH] fix: submenu trigger double click event #1450 --- components/vc-menu/SubPopupMenu.jsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/components/vc-menu/SubPopupMenu.jsx b/components/vc-menu/SubPopupMenu.jsx index 457b5f799..f31e81a9b 100644 --- a/components/vc-menu/SubPopupMenu.jsx +++ b/components/vc-menu/SubPopupMenu.jsx @@ -308,6 +308,7 @@ const SubPopupMenu = { this.instanceArrayKeyIndexMap[key] = Object.keys(this.instanceArrayKeyIndexMap).length; } const childListeners = getEvents(child); + const isSubMenu = child.componentOptions && child.componentOptions.Ctor.options.isSubMenu; const newChildProps = { props: { mode: childProps.mode || props.mode, @@ -333,10 +334,12 @@ const SubPopupMenu = { ...extraProps, }, on: { - click: e => { - (childListeners.click || noop)(e); - this.onClick(e); - }, + click: isSubMenu + ? noop + : e => { + (childListeners.click || noop)(e); + this.onClick(e); + }, itemHover: this.onItemHover, openChange: this.onOpenChange, deselect: this.onDeselect,