今天学习vue-router时出现如下报错,百度了一下,好像是vue-router版本不兼容的问题,解决方法为在router/index.js文件中加入一段代码
报错提示信息
报错代码
需要插入的代码段
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
代码插入位置
参考文章
https://blog.csdn.net/luer_LJS/article/details/108362563