老师,请问,如果要在这里怎么加beforeEnter中的逻辑??
router.beforeEach((to, from, next) => {
const isLogin = localStorage.isLogin
if (isLogin || to.name === 'Login') {
next()
} else {
next({ name: 'Login' })
}
next()
})
15
收起
正在回答
1回答
同学你好,直接写在router.beforeEach((to, from, next) => { // 需要处理的逻辑写在这里即可}
祝学习愉快!

恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星