在vue项目中重复点击导航会报错,大概意思就是避免冗余导航。
解决方法:重写路由原型上的push方法,把这段代码加在router文件夹下的index.js文件里
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
在vue项目中重复点击导航会报错,大概意思就是避免冗余导航。
解决方法:重写路由原型上的push方法,把这段代码加在router文件夹下的index.js文件里
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}