VUE_Vue-router报错 Avoided redundant navigation to current location 解决问题

在vue项目中路由跳转过程中浏览器会报Avoided redundant navigation to current location 这个错误,解决方法:在路由文件里添加这一句可解决报错问题

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

猜你喜欢

转载自blog.csdn.net/weixin_44599931/article/details/108702737