须在路由文件中对路由方法进行重写
const VueRouterPush = Router.prototype.push
Router.prototype.push = function push (to) {
return VueRouterPush.call(this, to).catch(err => err)
}
const VueRouterReplace = Router.prototype.replace
Router.prototype.replace = function replace (to) {
return VueRouterReplace.call(this, to).catch(err => err)
}