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

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

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

 npm i vue-router@3.0 -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)
}

参考来源:https://blog.csdn.net/weixin_43202608/article/details/98884620

以上。

第二种方法未测试,使用第一种方法后问题就已经得到解决了。

原文地址:https://www.cnblogs.com/dawn-sky/p/11532164.html