如题:router.beforeEach((to, from, next) => { if (to.matched.some(record => record.meta.requiresAuth)) { next("/")
console.log(1)
}else { next()
}
})直接跳过了next("/")打印了1,不知是不是bug还是我的写法有问题。
1 回答

白板的微信
TA贡献1883条经验 获得超3个赞
router.beforeEach((to, from, next) => {
if (to.matched.some(m => m.meta.requiresAuth)) return next('/login')
next()
})
添加回答
举报
0/150
提交
取消