VueRouter push报错处理

const originalPush = Router.prototype.push
// eslint-disable-next-line
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err)
}

const originalReplace = Router.prototype.replace
Router.prototype.replace = function push(location) {
  return originalReplace.call(this, location).catch((err) => err)
}
posted @ 2022-10-31 09:26  吃饭七分饱  阅读(46)  评论(0编辑  收藏  举报