Skip to content

Commit

Permalink
fix: #318
Browse files Browse the repository at this point in the history
  • Loading branch information
kailong321200875 committed Aug 21, 2023
1 parent ae29e97 commit 4169e52
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/store/modules/tagsView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4169e52

Please sign in to comment.