解决方法一:通过屡次尝试发现缘由多是 在从新下载依赖包时,安装的vue-router仍是以前出错的那个版本,vue
解决方法也很简单,在项目目录下运行 npm i vue-router@3.0 -S 便可。vue-router
解决方法二:若是你不想用方法一那就在 main.js里添加一段代码。npm
import Router from 'vue-router' const routerPush = Router.prototype.push Router.prototype.push = function push(location) { return routerPush.call(this, location).catch(error=> error) }