tag栏重复的问题

 

export const routeEqual = (route1, route2) => {
  if (!route1 || !route2) {
    return true
  }
  const params1 = route1 && route1.params ? route1.params : {}
  const params2 = route2 && route2.params ? route2.params : {}
  const query1 = route1 && route1.query ? route1.query : {}
  const query2 = route2 && route2.query ? route2.query : {}
  // 课程路径,只对比id。目的为了选中topMenu。path 有可能为空,最好能通过route.name获取到path来截取对比
  let isCoursePath = false
  let path = route1.path || route2.path || window.location.pathname
  if (path) {
    if (sliceUrl(path, 0, 4).indexOf('training/course') > -1) {
      isCoursePath = true
    }
    if (sliceUrl(path, 0, 4).indexOf('training/responsible-course') > -1) {
      isCoursePath = true
    }
    if (sliceUrl(path, 0, 5).indexOf('maintenance/training/course') > -1) {
      isCoursePath = true
    }
    if (sliceUrl(path, 0, 5).indexOf('audit/auditList/course') > -1) {
      isCoursePath = true
    }
    if (sliceUrl(path, 0, 5).indexOf('examination/examination/home') > -1) {
      isCoursePath = true
    }
  }
  if (isCoursePath) {
    let uniqueId1 = route1.meta.uniqueId || query1.id
    let uniqueId2 = route2.meta.uniqueId || query2.id
    // 判断参数一致
    let uniqueIdEqual = uniqueId1 && String(uniqueId1) === String(uniqueId2)
    // 新增不判断是同一个窗口
    let isNotAddNew = !(String(route2.meta.addCourse) === 'true' || String(route1.meta.addCourse) === 'true')
    if (isNotAddNew && uniqueIdEqual) {
      return true
    }
  }
  let result = route1.name === route2.name && objEqual(params1, params2) && objEqual(query1, query2)
  return result
}

在这边加上考试的路径就行了去校验

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值