在前置路由里面,
判断一下是否为空再进行操作
代码如下:
if (to.matched.length == 0) {
router.push(to.path);
}
整体代码
router.beforeEach((to, from, next) => {
if (to.matched.length == 0) {
router.push(to.path);
}
next()
})
在前置路由里面,
判断一下是否为空再进行操作
代码如下:
if (to.matched.length == 0) {
router.push(to.path);
}
整体代码
router.beforeEach((to, from, next) => {
if (to.matched.length == 0) {
router.push(to.path);
}
next()
})