NavigationDuplicated错误显示

Vue3.1版本出现中此异常,在路由器中添加如下代码

//先把原来的push方法保存起来
const originPush = VueRouter.prototype.push
const originReplace = VueRouter.prototype.replace
//把原来的push修改为另外一个方法
VueRouter.prototype.push = function(location,resolved,rejected){
  if(resolved === undefined && rejected === undefined){
    return originPush.call(this,location).catch(() => {})
  }else{
    return originPush.call(this,location,resolved,rejected)
  }
}

VueRouter.prototype.replace = function(location,resolved,rejected){
  if(resolved === undefined && rejected === undefined){
    return originReplace.call(this,location).catch(() => {})
  }else{
    return originReplace.call(this,location,resolved,rejected)
  }
}

NavigationDuplicated错误显示

上一篇:Codeforces 553C Love Triangles 题解


下一篇:testNG测试基础一