vue-element-admin关闭标签跳转到前一个标签,而不是最近的标签

vue-element-admin中关闭标签跳转到前一个标签,而不是最近的标签。

场景:先后打开A和B标签,接着从A标签页面内部跳转到C标签(A和C存在紧密关系)。这时如果关闭C标签,默认跳转到最近的B标签而不是A标签。如果A和C中间隔着很多标签,这种场景很难在找回A标签的位置。期望跳转时从A跳转到C处理业务,处理完成后关闭C自动跳转回A.

 

修改文件./src/views/layout/components/TagsView.vue

toLastView(visitedViews, view) {
  const latestView = visitedViews.slice(-1)[0]
  if (latestView) {
    if (visitedViews.length <= 1 || window.history.state == null || window.history.state.back === null) {
      this.$router.push(latestView.fullPath)
    } else {
      this.$router.go(-1)
    }
  } else {
   ...
  }
}

 

转载请注明出处:https:https://www.cnblogs.com/keitsi/p/17970490

posted @ 2024-01-17 17:18  keitsi  阅读(61)  评论(0编辑  收藏  举报