将代码写入到main.ts
const VueRouterPush = VueRouter.prototype.push
const VueRouterReplace = VueRouter.prototype.replace
VueRouter.prototype.push = function push (to: any) {
const call = VueRouterPush.call(this, to) as any
return call.catch((err: any) => err)
}
VueRouter.prototype.replace = function replace (to: any) {
const call = VueRouterReplace.call(this, to) as any
return call.catch((err: any) => err)
}