双霖 - LineSoft双霖 - LineSoft
主页 && 博客项目友链关于
  • 标签
  • vue-router
2021-02-28发表2022-04-18更新技术 / 前端3 分钟读完 (大约506个字)

Vue中$router.push的Redirected when going from xxx to xxx via a navigation guard.问题解决过程

今天在做Vue项目时,我需要让Router路由到某个path后自动跳转到另一个path,于是就写了个守卫来实现:

1
2
3
4
5
6
7
router.beforeEach((to, from, next) => {
if (to.path == "/norm") {
next("/norm/principle")
} else {
next()
}
})

但是跳转的时候却遇到了这么个报错:

阅读更多
双霖 - LineSoft 双霖 - LineSoft

© 2022 linesoft  Proudly powered by Hexo & Icarus

京ICP备17046387号-1

×