Cascader: prevent value changing when menu is closing (#12507)

pull/12539/head
huangjinqiang 2018-08-29 13:48:50 +08:00 committed by Jikkai Xiao
parent 03ae4a446a
commit 8a32c3414f
1 changed files with 8 additions and 6 deletions

View File

@ -230,12 +230,14 @@
hover: 'mouseenter' hover: 'mouseenter'
}[expandTrigger]; }[expandTrigger];
const triggerHandler = () => { const triggerHandler = () => {
if (this.visible) {
this.activeItem(item, menuIndex); this.activeItem(item, menuIndex);
this.$nextTick(() => { this.$nextTick(() => {
// adjust self and next level // adjust self and next level
this.scrollMenu(this.$refs.menus[menuIndex]); this.scrollMenu(this.$refs.menus[menuIndex]);
this.scrollMenu(this.$refs.menus[menuIndex + 1]); this.scrollMenu(this.$refs.menus[menuIndex + 1]);
}); });
}
}; };
events.on[triggerEvent] = triggerHandler; events.on[triggerEvent] = triggerHandler;
if (triggerEvent === 'mouseenter' && this.changeOnSelect) { if (triggerEvent === 'mouseenter' && this.changeOnSelect) {