This commit is contained in:
kailong321200875 2023-08-21 09:40:09 +08:00
parent ae29e974bf
commit 4169e52baa
1 changed files with 10 additions and 2 deletions

View File

@ -4,6 +4,12 @@ import { getRawRoute } from '@/utils/routerHelper'
import { defineStore } from 'pinia'
import { store } from '../index'
import { findIndex } from '@/utils'
import { useStorage } from '@/hooks/web/useStorage'
import { useAppStoreWithOut } from './app'
const appStore = useAppStoreWithOut()
const { getStorage } = useStorage()
export interface TagsViewState {
visitedViews: RouteLocationNormalizedLoaded[]
@ -49,7 +55,7 @@ export const useTagsViewStore = defineStore('tagsView', {
const cacheMap: Set<string> = new Set()
for (const v of this.visitedViews) {
const item = getRawRoute(v)
const needCache = !item.meta?.noCache
const needCache = !item?.meta?.noCache
if (!needCache) {
continue
}
@ -90,7 +96,9 @@ export const useTagsViewStore = defineStore('tagsView', {
// 删除所有tag
delAllVisitedViews() {
// const affixTags = this.visitedViews.filter((tag) => tag.meta.affix)
this.visitedViews = this.visitedViews.filter((tag) => tag.meta?.affix)
this.visitedViews = getStorage(appStore.getUserInfo)
? this.visitedViews.filter((tag) => tag?.meta?.affix)
: []
},
// 删除其它
delOthersViews(view: RouteLocationNormalizedLoaded) {