vue router 报错: Uncaught (in promise) NavigationDuplicated {_name:""NavigationDuplicated"... 的解决方法

重复点击同一个的路由的发生如下报错
vue router 报错: Uncaught (in promise) NavigationDuplicated {_name:

我使用vue-router 的版本是 3.0.3

解决办法

  • 方法1
yarn remove vue-router
yarn add [email protected]

版本引起的原因,退回版本即可。

方法2:(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)
}

你可能感兴趣的:(vue2.0)