说明
使用 编程式导航时,点击两次,会报错,详见 链接
解决方式一
在 router/index.js 导入包的下面,增加下面代码:
const includPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return includPush.call(this, location).catch(err => err)
}
解决方式二
在 main.js 导入包的下面,增加下面代码:
const includPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return includPush.call(this, location).catch(err => err)
}