mirror of
https://gitee.com/ElemeFE/element.git
synced 2024-12-03 04:39:09 +08:00
[ElMenu]: active menuitem which matches user specfied route
This commit is contained in:
parent
775d5c16ea
commit
48009e21e1
@ -107,6 +107,14 @@
|
||||
},
|
||||
openActiveItemMenus() {
|
||||
let index = this.activeIndex;
|
||||
// 选中用户指定的路由对应的menu
|
||||
if (this.router) {
|
||||
const userSpecifiedIndexs = Object
|
||||
.keys(this.menuItems)
|
||||
.filter(k => this.menuItems[k].route)
|
||||
.filter(k => this.menuItems[k].route.path === this.$route.path);
|
||||
userSpecifiedIndexs.length && (index = this.activeIndex = userSpecifiedIndexs[0]);
|
||||
}
|
||||
if (!this.menuItems[index]) return;
|
||||
if (index && this.mode === 'vertical') {
|
||||
let indexPath = this.menuItems[index].indexPath;
|
||||
|
Loading…
Reference in New Issue
Block a user