// 在index.js 里面写入下面的代码即可解决
const originalReplace = Router.prototype.replace;
Router.prototype.replace = function replace(location) {
return originalReplace.call(this, location).catch(err => err);
};
// 在index.js 里面写入下面的代码即可解决
const originalPush = Router.prototype.push;
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
};
上面两段代码二选一或都写上去,看那个能解决吧