方法1:
在项目目录下运行 npm i vue-router@3.0 -S 即可
方法2:
如果不想换 vue-router 的版本 或者 还是 没有用
在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)
}