如题,vue报错:
Uncaught (in promise) Error: Redirected when going from "/home" to "/user" via a navigation guard.
我的实际代码:
router.beforeEach((to, from, next) => {
const meta = to.meta ? to.meta : {}
const permission = meta.permission ? meta.permission : []
const hasLogin = !localStorage.login_token && to.path !== '/' && permission.includes('login')
if (hasLogin) {
next('/login')
} else {
next()
}
})