fix: submenu trigger double click event #1450

pull/1460/head
tanjinzhou 2019-11-21 10:49:41 +00:00
parent 5d17c7f435
commit 910a62eb4a
1 changed files with 7 additions and 4 deletions

View File

@ -308,6 +308,7 @@ const SubPopupMenu = {
this.instanceArrayKeyIndexMap[key] = Object.keys(this.instanceArrayKeyIndexMap).length; this.instanceArrayKeyIndexMap[key] = Object.keys(this.instanceArrayKeyIndexMap).length;
} }
const childListeners = getEvents(child); const childListeners = getEvents(child);
const isSubMenu = child.componentOptions && child.componentOptions.Ctor.options.isSubMenu;
const newChildProps = { const newChildProps = {
props: { props: {
mode: childProps.mode || props.mode, mode: childProps.mode || props.mode,
@ -333,10 +334,12 @@ const SubPopupMenu = {
...extraProps, ...extraProps,
}, },
on: { on: {
click: e => { click: isSubMenu
(childListeners.click || noop)(e); ? noop
this.onClick(e); : e => {
}, (childListeners.click || noop)(e);
this.onClick(e);
},
itemHover: this.onItemHover, itemHover: this.onItemHover,
openChange: this.onOpenChange, openChange: this.onOpenChange,
deselect: this.onDeselect, deselect: this.onDeselect,