Error: Avoided redundant navigation to current location: 的错

错误:在VUE中路由遇到Error: Avoided redundant navigation to current location:报错显示是路由重复

解决办法:

在引入router时,加上

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

具体加入的位置:router.js

如果是使用VueRouter,就在引入VueRouter的时候再加上

有兴趣的朋友可以关注下个人的一个公众号:积跬步成江河

猜你喜欢

转载自blog.csdn.net/qq_41687299/article/details/106869943
今日推荐