router.beforeEach((to, from, next) => {
let login = localStorage.getItem(‘token’) ? true : false
if (to.path == ‘/’) {
next()
} else {
if (login) {
next()
} else {
next({
path: ‘/’,
query: {
redirect: to.fullPath
}
})
}
}
})
登录跳转控制,重定向
最新推荐文章于 2022-08-24 10:29:54 发布