修复BUG: 修复页面缓存问题

This commit is contained in:
猿小天
2024-02-25 16:30:49 +08:00
parent 77a27cba14
commit d3e5f258e5

View File

@@ -3,9 +3,7 @@
<router-view v-slot="{ Component }"> <router-view v-slot="{ Component }">
<transition :name="setTransitionName" mode="out-in"> <transition :name="setTransitionName" mode="out-in">
<keep-alive :include="getKeepAliveNames" v-if="showView"> <keep-alive :include="getKeepAliveNames" v-if="showView">
<div>
<component :is="Component" :key="state.refreshRouterViewKey" class="w100" v-show="!isIframePage" /> <component :is="Component" :key="state.refreshRouterViewKey" class="w100" v-show="!isIframePage" />
</div>
</keep-alive> </keep-alive>
</transition> </transition>
</router-view> </router-view>
@@ -61,6 +59,7 @@ const setTransitionName = computed(() => {
}); });
// 获取组件缓存列表(name值) // 获取组件缓存列表(name值)
const getKeepAliveNames = computed(() => { const getKeepAliveNames = computed(() => {
console.log(cachedViews.value)
return themeConfig.value.isTagsview ? cachedViews.value : state.keepAliveNameList; return themeConfig.value.isTagsview ? cachedViews.value : state.keepAliveNameList;
}); });
// 设置 iframe 显示/隐藏 // 设置 iframe 显示/隐藏