路由权限:
页面登录成功后,执行下面的代码,把后端返回的路由数据用
this.$router.addRoutes() // 添加
this.$router.addRoutes([
{
path: '/admin',
component: () => import('../views/admin.vue')
}
]),
// 这样就需要通过beforeEach、beforeEnter之类的去路由守卫了。
路由权限:
页面登录成功后,执行下面的代码,把后端返回的路由数据用
this.$router.addRoutes() // 添加
this.$router.addRoutes([
{
path: '/admin',
component: () => import('../views/admin.vue')
}
]),
// 这样就需要通过beforeEach、beforeEnter之类的去路由守卫了。