feature[Sidebar]: add activeMenu option (#1833)

This commit is contained in:
花裤衩
2019-04-08 12:58:33 +08:00
committed by GitHub
parent 083a4ada9d
commit 79e2a604af
2 changed files with 30 additions and 21 deletions

View File

@@ -3,7 +3,7 @@
<logo v-if="showLogo" :collapse="isCollapse" />
<el-scrollbar wrap-class="scrollbar-wrapper">
<el-menu
:default-active="$route.path"
:default-active="activeMenu"
:collapse="isCollapse"
:background-color="variables.menuBg"
:text-color="variables.menuText"
@@ -30,6 +30,15 @@ export default {
'permission_routes',
'sidebar'
]),
activeMenu() {
const route = this.$route
const { meta, path } = route
// if set path, the sidebar will highlight the path you set
if (meta.activeMenu) {
return meta.activeMenu
}
return path
},
showLogo() {
return this.$store.state.settings.sidebarLogo
},