出现这个错误的原因是,在路由跳转的时候两次push的path地址相同

解决方法两种:

1.切换版本回3.0版本

2.在你引了vue-router的js文件里加上如下代码即可

import VueRouter from "vue-router";
// 解决两次访问相同路由地址报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

 

 

相关文章:

  • 2022-02-06
  • 2022-12-23
  • 2021-08-13
  • 2022-12-23
  • 2021-12-18
  • 2021-07-17
  • 2021-04-11
猜你喜欢
  • 2021-09-14
  • 2022-12-23
  • 2021-11-05
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2022-12-23
相关资源
相似解决方案