解决NavigationDuplicated Avoided redundant navigation to current location

解决NavigationDuplicated: Avoided redundant navigation to current location

1.在router文件中的index添加代码

....
Vue.use(VueRouter)
//在这个位置添加如下代码
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    
    
  return originalPush.call(this, location).catch(err => err)
}

2.在进行路由跳转的时候要用push方法,不能用replace方法

猜你喜欢

转载自blog.csdn.net/qq_44255146/article/details/116123447