From 094a9dcb3b2a797f2179631ed7a3d8df59824092 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=A0=E9=BE=99?= Date: Thu, 14 Apr 2022 15:30:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=8C=E6=AC=A1?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E6=A0=87=E7=AD=BE=E9=A1=B5=E4=BC=9A?= =?UTF-8?q?=E5=A4=9A=E5=87=BA=E7=99=BB=E5=BD=95=E6=A0=87=E7=AD=BE=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/tags/helpers.js | 2 ++ src/store/modules/tags/index.js | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/store/modules/tags/helpers.js b/src/store/modules/tags/helpers.js index 71c3eb2..d10e33c 100644 --- a/src/store/modules/tags/helpers.js +++ b/src/store/modules/tags/helpers.js @@ -3,3 +3,5 @@ import { createSessionStorage } from '@/utils/cache' export const tagsSS = createSessionStorage({ prefixKey: 'tag_' }) export const activeTag = tagsSS.get('activeTag') export const tags = tagsSS.get('tags') + +export const WITHOUT_TAG_PATHS = ['/404', '/login', '/redirect'] diff --git a/src/store/modules/tags/index.js b/src/store/modules/tags/index.js index ef8aa52..715a2f4 100644 --- a/src/store/modules/tags/index.js +++ b/src/store/modules/tags/index.js @@ -1,5 +1,5 @@ import { defineStore } from 'pinia' -import { tagsSS, activeTag, tags } from './helpers' +import { tagsSS, activeTag, tags, WITHOUT_TAG_PATHS } from './helpers' export const useTagsStore = defineStore('tag', { state() { @@ -14,7 +14,7 @@ export const useTagsStore = defineStore('tag', { tagsSS.set('activeTag', path) }, addTag(tag = {}) { - if (this.tags.some((item) => item.path === tag.path)) return + if (WITHOUT_TAG_PATHS.includes(tag.path) || this.tags.some((item) => item.path === tag.path)) return this.tags.push(tag) tagsSS.set('tags', this.tags) },