问题如下图提示:
解决方法:将以下代码写到router中的index.js中
const originalPush = VueRouter.prototype.push
const originalReplace = VueRouter.prototype.replace
VueRouter.prototype.push = function push (location, onResolve, onReject) {
if (onResolve || onReject) { return originalPush.call(this, location, onResolve, onReject) }
return originalPush.call(this, location).catch(err => err)
}
VueRouter.prototype.replace = function push (location, onResolve, onReject) {
if (onResolve || onReject) { return originalReplace.call(this, location, onResolve, onReject) }
return originalReplace.call(this, location).catch(err => err)
}
亲测有效~
|