From 0db8c9b94a9ac655549d5eba5c2a6c92ac386c06 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 08 十月 2026 11:20:56 +0800
Subject: [PATCH] 提交最新代码
---
culture/src/layouts/components/HeaderNav.vue | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/culture/src/layouts/components/HeaderNav.vue b/culture/src/layouts/components/HeaderNav.vue
index 0c66d87..1deaf24 100644
--- a/culture/src/layouts/components/HeaderNav.vue
+++ b/culture/src/layouts/components/HeaderNav.vue
@@ -12,8 +12,8 @@
<i @click="clickFold" class="el-icon-s-fold"></i>
<!-- 标签列表 -->
<div class="tag-list-container" @wheel.prevent="handleWheel">
- <div class="tag-list" v-for="tag in tagList" :key="tag.name">
- <div @click="goTag(tag)" :class="{ 'activeTag': tag.path === $route.path }">
+ <div class="tag-list" v-for="tag in tagList" :key="tag.cacheKey || tag.fullPath || tag.path">
+ <div @click="goTag(tag)" :class="{ 'activeTag': getTagFullPath(tag) === $route.fullPath }">
{{ tag.meta.title }}
</div>
<i @click="closeTag(tag)" v-if="tagList.length > 1" class="el-icon-close"></i>
@@ -35,6 +35,7 @@
<script>
import { mapState } from 'vuex'
+import { closeRouteView, getTagFullPath } from '@/utils/view-tabs'
export default {
data() {
return {
@@ -72,22 +73,22 @@
},
// 关闭标签
closeTag(tag) {
- this.$store.commit('SET_TAGLIST', this.tagList.filter(item => item.path !== tag.path))
- // 判断是否是当前标签
- if (tag.path === this.$route.path) {
- // if (this.tagList.length > 1) {
- this.$router.push(this.tagList[this.tagList.length - 1].path)
- // } else {
- // // this.$router.push('/welcome')
- // }
- }
+ closeRouteView({
+ router: this.$router,
+ store: this.$store,
+ route: this.$route,
+ tag
+ })
},
// 跳转标签
goTag(tag) {
- this.$router.push({
+ this.$router.push(tag.fullPath || {
path: tag.path,
- query: tag.query
+ query: tag.query || {}
})
+ },
+ getTagFullPath(tag) {
+ return getTagFullPath(this.$router, tag)
},
handleWheel(e) {
if (this.scrollTimer) {
@@ -259,4 +260,4 @@
}
}
}
-</style>
\ No newline at end of file
+</style>
--
Gitblit v1.7.1