- 报错信息:
- 解决方法:
// 使用 $router.replace做路由跳转:
const originalReplace = Router.prototype.replace;
Router.prototype.replace = function replace(location) {
return originalReplace.call(this, location).catch(err => err);
};
// 使用 $router.push做路由跳转:
const routerPush = Router.prototype.push;
Router.prototype.push = function push(location) {
return routerPush.call(this, location).catch(error => error);
};