Vue 重复进入相同路由消除警报

如果是push
const originalReplace = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalReplace.call(this, location).catch(err => err)
}
Vue.use(VueRouter)
如果是replace
const originalReplace = VueRouter.prototype.replace
VueRouter.prototype.replace= function replace(location) {
  return originalReplace.call(this, location).catch(err => err)
}
Vue.use(VueRouter)
 
..............
原文地址:https://www.cnblogs.com/otome/p/13700505.html