This commit is contained in:
zhuoda
2020-04-08 20:15:01 +08:00
15 changed files with 615 additions and 837 deletions

View File

@@ -11,7 +11,7 @@
v-show="!collapsed"
width="auto"
>
<template v-for="item in menuList">
<template v-for="item in menuList">
<template v-if="item.children && item.children.length === 1">
<side-menu-item :key="`menu-${item.name}`" :parent-item="item.children[0]" v-if="item.children[0].children && item.children[0].children.length > 0 "></side-menu-item>
<menu-item
@@ -179,9 +179,6 @@ export default {
},
// 从激活菜单的名称中获取打开的菜单
getOpenedNamesByActiveName(name) {
// return this.$route.matched
// .map(item => item.name)
// .filter(item => item !== name);
let array = this.menuNameMatchedMap.get(name);
if(array){
return array;
@@ -190,8 +187,6 @@ export default {
}
},
updateOpenName(name) {
// if (name === this.$config.homeName) this.openedNames = [];
// else this.openedNames = this.getOpenedNamesByActiveName(name);
this.openedNames = this.menuNameMatchedMap.get(name);
}
}

View File

@@ -363,11 +363,17 @@ export default {
}
}
}
console.log('privilegeTree',privilegeTree)
this.menuList = privilegeTree;
},
recursion(children, parentMenu) {
for (const router of children) {
//验证权限
if (this.$store.state.user.privilegeMenuKeyList.indexOf(router.name) ===-1) {
continue;
}
//过滤非菜单
if (!router.meta.hideInMenu) {
//验证权限
@@ -393,7 +399,6 @@ export default {
let menuNameArray = this.menuNameMatchedMap.get(parentMenu.name);
this.menuNameMatchedMap.set(menu.name, [...menuNameArray, menu.name]);
parentMenu.children.push(menu);
//存在孩子节点,开始递归
if (router.children && router.children.length > 0) {