Browse Source

vue-router use addRoute

vue-admin-beautiful.com 3 years ago
parent
commit
e54c435ba1
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/config/permission.js

+ 3 - 1
src/config/permission.js

@@ -54,7 +54,9 @@ router.beforeResolve(async (to, from, next) => {
           } else if (authentication === 'all') {
             accessRoutes = await store.dispatch('routes/setAllRoutes')
           }
-          router.addRoutes(accessRoutes)
+          accessRoutes.forEach((item) => {
+            router.addRoute(item)
+          })
           next({ ...to, replace: true })
         } catch {
           await store.dispatch('user/resetAccessToken')