Merge pull request #1974 from leftstick/dev

[ElMenu]: active menuitem which matches user specfied route
pull/1994/head
baiyaaaaa 2016-12-26 14:39:07 +08:00 committed by GitHub
commit 05a442f694
1 changed files with 8 additions and 0 deletions

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;