fix: 修复二次登录后标签页会多出登录标签问题
This commit is contained in:
parent
db5089d92e
commit
094a9dcb3b
@ -3,3 +3,5 @@ import { createSessionStorage } from '@/utils/cache'
|
|||||||
export const tagsSS = createSessionStorage({ prefixKey: 'tag_' })
|
export const tagsSS = createSessionStorage({ prefixKey: 'tag_' })
|
||||||
export const activeTag = tagsSS.get('activeTag')
|
export const activeTag = tagsSS.get('activeTag')
|
||||||
export const tags = tagsSS.get('tags')
|
export const tags = tagsSS.get('tags')
|
||||||
|
|
||||||
|
export const WITHOUT_TAG_PATHS = ['/404', '/login', '/redirect']
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { tagsSS, activeTag, tags } from './helpers'
|
import { tagsSS, activeTag, tags, WITHOUT_TAG_PATHS } from './helpers'
|
||||||
|
|
||||||
export const useTagsStore = defineStore('tag', {
|
export const useTagsStore = defineStore('tag', {
|
||||||
state() {
|
state() {
|
||||||
@ -14,7 +14,7 @@ export const useTagsStore = defineStore('tag', {
|
|||||||
tagsSS.set('activeTag', path)
|
tagsSS.set('activeTag', path)
|
||||||
},
|
},
|
||||||
addTag(tag = {}) {
|
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)
|
this.tags.push(tag)
|
||||||
tagsSS.set('tags', this.tags)
|
tagsSS.set('tags', this.tags)
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user