fix: #318
This commit is contained in:
parent
ae29e974bf
commit
4169e52baa
|
@ -4,6 +4,12 @@ import { getRawRoute } from '@/utils/routerHelper'
|
||||||
import { defineStore } from 'pinia'
|
import { defineStore } from 'pinia'
|
||||||
import { store } from '../index'
|
import { store } from '../index'
|
||||||
import { findIndex } from '@/utils'
|
import { findIndex } from '@/utils'
|
||||||
|
import { useStorage } from '@/hooks/web/useStorage'
|
||||||
|
import { useAppStoreWithOut } from './app'
|
||||||
|
|
||||||
|
const appStore = useAppStoreWithOut()
|
||||||
|
|
||||||
|
const { getStorage } = useStorage()
|
||||||
|
|
||||||
export interface TagsViewState {
|
export interface TagsViewState {
|
||||||
visitedViews: RouteLocationNormalizedLoaded[]
|
visitedViews: RouteLocationNormalizedLoaded[]
|
||||||
|
@ -49,7 +55,7 @@ export const useTagsViewStore = defineStore('tagsView', {
|
||||||
const cacheMap: Set<string> = new Set()
|
const cacheMap: Set<string> = new Set()
|
||||||
for (const v of this.visitedViews) {
|
for (const v of this.visitedViews) {
|
||||||
const item = getRawRoute(v)
|
const item = getRawRoute(v)
|
||||||
const needCache = !item.meta?.noCache
|
const needCache = !item?.meta?.noCache
|
||||||
if (!needCache) {
|
if (!needCache) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -90,7 +96,9 @@ export const useTagsViewStore = defineStore('tagsView', {
|
||||||
// 删除所有tag
|
// 删除所有tag
|
||||||
delAllVisitedViews() {
|
delAllVisitedViews() {
|
||||||
// const affixTags = this.visitedViews.filter((tag) => tag.meta.affix)
|
// 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) {
|
delOthersViews(view: RouteLocationNormalizedLoaded) {
|
||||||
|
|
Loading…
Reference in New Issue