mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-04 05:09:43 +08:00
menu item select event improve
This commit is contained in:
parent
81e79fac72
commit
0c75354eb5
@ -28,7 +28,12 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleClick() {
|
handleClick() {
|
||||||
this.rootMenu.handleSelect(this.index, this.indexPath, this.route || this.index);
|
this.rootMenu.handleSelect(
|
||||||
|
this.index,
|
||||||
|
this.indexPath,
|
||||||
|
this.route || this.index,
|
||||||
|
this
|
||||||
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -47,9 +47,10 @@
|
|||||||
defaultActive(value) {
|
defaultActive(value) {
|
||||||
this.activeIndex = value;
|
this.activeIndex = value;
|
||||||
if (!this.menuItems[value]) return;
|
if (!this.menuItems[value]) return;
|
||||||
let indexPath = this.menuItems[value].indexPath;
|
let menuItem = this.menuItems[value];
|
||||||
|
let indexPath = menuItem.indexPath;
|
||||||
|
|
||||||
this.handleSelect(value, indexPath);
|
this.handleSelect(value, indexPath, null, menuItem);
|
||||||
},
|
},
|
||||||
defaultOpeneds(value) {
|
defaultOpeneds(value) {
|
||||||
this.openedMenus = value;
|
this.openedMenus = value;
|
||||||
@ -81,9 +82,9 @@
|
|||||||
this.$emit('open', index, indexPath);
|
this.$emit('open', index, indexPath);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleSelect(index, indexPath, route) {
|
handleSelect(index, indexPath, route, instance) {
|
||||||
this.activeIndex = index;
|
this.activeIndex = index;
|
||||||
this.$emit('select', index, indexPath);
|
this.$emit('select', index, indexPath, instance);
|
||||||
|
|
||||||
if (this.mode === 'horizontal') {
|
if (this.mode === 'horizontal') {
|
||||||
this.broadcast('submenu', 'item-select', [index, indexPath]);
|
this.broadcast('submenu', 'item-select', [index, indexPath]);
|
||||||
|
Loading…
Reference in New Issue
Block a user