Browse Source

权限为空时默认显示主页

gr 2 years ago
parent
commit
a49b328324
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/utils/createRoutes.js

+ 1 - 1
src/utils/createRoutes.js

@@ -36,7 +36,7 @@ function selectRoutes(routes, names) {
 const initDynamicRoutesFunc = () => {
   let [...defRoutes] = defaultRoutes
   let authorityNameArr = initauthorityNameArr(JSON.parse(getCookie('authority'))[0].children,[])
-  let selectedRoutes = selectRoutes(defRoutes[0].children, authorityNameArr)
+  let selectedRoutes = selectRoutes(defRoutes[0].children, authorityNameArr.length>0? authorityNameArr: ["Home"]) // 权限为空时默认加入首页
   defRoutes[0].children = selectedRoutes
   resetRouter()
   router.options.routes = defRoutes