[ElMenu]: active menuitem which matches user specfied route

This commit is contained in:
Howard.Zuo 2016-12-25 17:12:45 +08:00
parent 775d5c16ea
commit 48009e21e1

View File

@ -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;