Commit 1323310e authored by Zhang Xiaojie's avatar Zhang Xiaojie

Merge remote-tracking branch 'origin/dev' into dev

parents 668b1aaa b0a3732f
......@@ -24,6 +24,9 @@ const routes: Array<RouteConfig> = [
component: item.component,
meta: {
roles: item.roles,
selectedName: item.belongToMenuName
? item.belongToMenuName
: item.routeName,
},
children: ((item.getChildren && item.getChildren()) || []).map(
(subItem) => {
......@@ -33,6 +36,9 @@ const routes: Array<RouteConfig> = [
component: subItem.component,
meta: {
roles: subItem.roles,
selectedName: item.belongToMenuName
? item.belongToMenuName
: item.routeName,
},
}
},
......
......@@ -10,7 +10,7 @@
:selectedKeys="selectedKeys"
>
<component
v-for="menu in menuList"
v-for="menu in filteredMenuList"
:key="menu.routeName"
@click="handleClickMenu"
:is="hasChildren(menu) ? 'a-sub-menu' : 'a-menu-item'"
......@@ -78,8 +78,11 @@ export default Vue.extend({
menuList(): iMenuList {
return getMenuList(this.role);
},
filteredMenuList(): iMenuList {
return this.menuList.filter((i) => !i.hiddeInMenu);
},
selectedKeys() {
return [this.$route.name];
return [(this.$route.meta as { selectedName: string }).selectedName];
},
},
methods: {
......
......@@ -6,6 +6,8 @@ export interface iMenuConfigItem {
getName: (role: eRole) => string
getChildren?: () => Omit<iMenuConfigItem, 'getChildren'>[]
path?: string
belongToMenuName?: string
hiddeInMenu?: boolean
component?: Component
onClick?: (e: Event) => any
routeName?: string
......
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