Vue 2.x 中 路由当前页跳转到当前页 栈溢出

const originalReplace = Router.prototype.replace;
Router.prototype.replace = function replace(location) {
  return originalReplace.call(this, location).catch(err => err);
};

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

 

posted @ 2021-11-08 14:09  秋雁丁  阅读(338)  评论(0)    收藏  举报