From 065266e390bfda178d2f477539924d8e6c3f487e Mon Sep 17 00:00:00 2001
From: whychdw <496960745@qq.com>
Date: 星期三, 09 十月 2024 13:50:16 +0800
Subject: [PATCH] 修改tag-view的图标显示逻辑

---
 src/layout/components/TagsView/index.vue |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue
index be665e5..dbf27ea 100644
--- a/src/layout/components/TagsView/index.vue
+++ b/src/layout/components/TagsView/index.vue
@@ -4,10 +4,11 @@
       <router-link v-for="tag in visitedViews" :key="tag.path"
         :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }" custom
         v-slot="{ navigate, isActive, isExactActive }" ref="tag">
-        <span :class="['tags-view-item', isActive && 'router-link-active', isExactActive && 'router-link-exact-active']"
+        <span :class="['tags-view-item', isActive && 'router-link-active', isExactActive && 'router-link-exact-active', tag.meta.icon && 'hide-dot']"
           @click="navigate"
           @click.middle="!isAffix(tag) ? closeSelectedTag(tag) : ''"
           @contextmenu.prevent="openMenu(tag, $event)">
+          <svg-icon v-if="tag.meta.icon" :icon-class="tag.meta.icon" />
           {{ tag.title }}
           <icon-close v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
         </span>
@@ -28,10 +29,11 @@
 import path from 'path-browserify';
 import store from '@/store';
 import { Close as IconClose } from '@element-plus/icons-vue';
+import SvgIcon from '@/components/SvgIcon/index.vue';
 
 export default defineComponent({
   name: 'TagsView',
-  components: { ScrollPane, IconClose },
+  components: { SvgIcon, ScrollPane, IconClose },
   data() {
     return {
       visible: false,
@@ -243,6 +245,12 @@
           position: relative;
           margin-right: 2px;
         }
+        &.hide-dot {
+          &::before {
+            width: 0;
+            height: 0;
+          }
+        }
       }
     }
   }

--
Gitblit v1.9.1