路由守卫重置定向问题
来源:9-2 路由守卫实现基础登陆校验功能

alanZhang123
2022-04-22
老师:
为什么我在next()加参数,页面就无法显示了,还报了一推警告
router.beforeEach((to, from, next) => {
const isLogin = localStorage.getItem(‘isLogin’);
console.log(isLogin);
if (isLogin || to.name === ‘Login’) {
next();
} else {
next({ name: ‘Login’ });
}
next();
});
写回答
1回答
-
alanZhang123
提问者
2022-04-24
已解决
012023-01-12
相似问题