vue3.0vue-router报错解决方案

VUE.js项目中控制台报错: Uncaught (in promise) NavigationDuplicated解决方法

问题愿意:依赖包中vue-router出现问题(猜测为版本问题);

解决方法:在项目目录下运行

 npm i [email protected] -S

这条指令就可以解决了。(更换版本)

或者在main.js中添加以下代码:

import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
发布了70 篇原创文章 · 获赞 56 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/weixin_44251396/article/details/103852172