今天在用vue+element ui框架做后台管理系统时,又遇到了下图所示的报错:

报错显示,这是路由重复的问题,下面记录一下我使用的解决方案:

在项目中的router文件下的index.js中添加如下几行代码:
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
本文介绍了一种解决Vue+ElementUI项目中遇到的路由重复问题的方法。通过修改项目的router/index.js文件,重新定义VueRouter的push方法来避免错误。
167万+

被折叠的 条评论
为什么被折叠?



