问题描述
解决方案
废话不多说
- 打开router下边的index.js文件,然后复制粘贴以下代码段即可
let originPush = VueRouter.prototype.push
let originReplace = Vue.prototype.originReplace
VueRouter.prototype.push = function (location,res,rej) {
if (res && rej ) {
originPush.call(this,location,res,rej)
} else {
originPush.call(this,location,()=>{
},()=>{
})
}
}
VueRouter.prototype.replace = function(location ,res,rej) {
if (res && rej) {
originReplace.call(this,location,res,rej)
} else {
originReplace.call(this,location,() => {
},() => {
})
}
}