From 37a58efecacaf047b7e914a193c9276a5a20ce00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E5=B4=87=E6=A0=8B?= <786631302qq.com> Date: Wed, 9 Dec 2020 13:58:05 +0800 Subject: [PATCH] save --- src/components/common/the-aside.vue | 33 +++++++++++------------------ 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/src/components/common/the-aside.vue b/src/components/common/the-aside.vue index 9f40a87..a9f53cc 100644 --- a/src/components/common/the-aside.vue +++ b/src/components/common/the-aside.vue @@ -51,20 +51,15 @@ export default { setRoute() { let parents = []; if (this.userInfo.id) { - parents = this.$router.options.routes[0].children.filter( - ele => { - if ( - this.userInfo.permissionList.some(item => { - return ( - item.rights === ele.name && - ele.name.indexOf("personal") < 0 - ); - }) - ) { - return ele; - } + parents = this.$router.options.routes[0].children.filter(ele => { + if ( + this.userInfo.permissionList.some(item => { + return item.rights === ele.name && ele.name.indexOf("center") < 0; + }) + ) { + return ele; } - ); + }); // // 递归权限路由 let recursionRoute = parents => { for (let i = 0; i < parents.length; i++) { @@ -79,11 +74,9 @@ export default { }; recursionRoute(parents); } else { - parents = this.$router.options.routes[0].children.filter( - item => { - return !item.name.startsWith("center"); - } - ); + parents = this.$router.options.routes[0].children.filter(item => { + return !item.name.startsWith("center"); + }); } this.routes = parents; @@ -96,9 +89,7 @@ export default { if (this.$route.matched.length > 3) { this.selectedKeys = [this.$route.matched[2].name]; } else { - this.selectedKeys = [ - this.$route.matched[this.$route.matched.length - 1].name - ]; + this.selectedKeys = [this.$route.matched[this.$route.matched.length - 1].name]; } } else { this.selectedKeys = [this.$route.matched[1].name];