其原因是在连续点击跳转连接后,其返回的是一个promise对象,该对象并没有成功和失败的回调所导致的。解决问题是在router文件夹中重写push和replace方法即可。
let originPush = VueRouter.prototype.push;
let originreplace = VueRouter.prototype.replace;
// 重写push
VueRouter.prototype.push = function (location, resolve, rereject) {
if (resolve && rereject) {
originPush.call(this, location, resolve, rereject)
} else {
originPush.call(this, location, () => {
}, () => {
})
}
}
// 重写replace
VueRouter.prototype.replace = function (location, resolve, rereject) {
if (resolve && rereject) {
originreplace.call(this, location, resolve, rereject)
} else {
originreplace.call(this, location, () => {
}, () => {
})
}
}