Commit 48009e21 authored by Howard.Zuo's avatar Howard.Zuo

[ElMenu]: active menuitem which matches user specfied route

parent 775d5c16
...@@ -107,6 +107,14 @@ ...@@ -107,6 +107,14 @@
}, },
openActiveItemMenus() { openActiveItemMenus() {
let index = this.activeIndex; 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 (!this.menuItems[index]) return;
if (index && this.mode === 'vertical') { if (index && this.mode === 'vertical') {
let indexPath = this.menuItems[index].indexPath; let indexPath = this.menuItems[index].indexPath;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment