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) },