如何设置vue路由器导航防护以路由到子路由而不会陷入无限循环?

时间:2019-11-15 03:44:02

标签: vue-router

我的路线有一个带孩子的父路径。如何在父路线上设置导航保护以路由到子路线而不会触发无限循环?

当我导航到“ path / parent / child1”或“ path / parent / child2”时,此beforeEnter循环被调用

path: "path/parent",
beforeEnter: (to, from, next) => {
if(checkSomethingInDB) {
if(checkSomethingElseInDB){
next()
}else{
next({name: 'child1'})
} else {
next({name: 'child2})
}
}
...

0 个答案:

没有答案