一个项目应用中头部导航的时候,我点了几次首页突然发现有个报错,如下图:

后来查了好多资料和百度都是说把版本降低到3.0.0,可是我试了没用。
然后又找资料发现:
第一: 把项目依赖的 node_modules 文件夹删除, 然后再 npm install 重新下载依赖包
第二:要在router.js页面引入
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
以上是自己测试的成功的: 完成图:

router.js中的

浏览器中:

以上内容自己项目中引用,这也是我自己保存给自己的;不喜勿喷 谢谢
网友评论