调整页面跳转后缓存问题

This commit is contained in:
Ledo 2025-08-21 14:25:45 +08:00
parent f7b2b96466
commit b8dcd6d572
2 changed files with 6 additions and 4 deletions

View File

@ -58,16 +58,17 @@ export const useTagsViewStore = defineStore('tagsView', {
},
// 删除某个
delView(view: RouteLocationNormalizedLoaded) {
routeParamsCache.remove(view.path)
this.delVisitedView(view)
this.delCachedView()
routeParamsCache.remove(view.path)
},
// 删除tag
delVisitedView(view: RouteLocationNormalizedLoaded) {
for (const [i, v] of this.visitedViews.entries()) {
if (v.path === view.path) {
routeParamsCache.remove(view.path)
this.visitedViews.splice(i, 1)
routeParamsCache.remove(view.path)
break
}
}
@ -116,7 +117,7 @@ export const useTagsViewStore = defineStore('tagsView', {
)
if (index > -1) {
this.visitedViews.filter((item,i) =>{
if(i < index && v.path !== view.path ){
if(i < index && item.path !== view.path ){
routeParamsCache.remove(item.path)
}
})
@ -134,7 +135,7 @@ export const useTagsViewStore = defineStore('tagsView', {
)
if (index > -1) {
this.visitedViews.filter((item,i) =>{
if(i > index && v.path !== view.path ){
if(i > index && item.path !== view.path ){
routeParamsCache.remove(item.path)
}
})

View File

@ -83,6 +83,7 @@ const routeParamsCache = {
remove(route: String) {
const path = getCacheKey(route);
if (this.cache.has(path)) {
this.cache.delete(path);
saveCache(this.cache);
return true;