Explorar el Código

vue-router use addRoute

vue-admin-beautiful.com hace 3 años
padre
commit
e54c435ba1
Se han modificado 1 ficheros con 3 adiciones y 1 borrados
  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')