This commit is contained in:
van
2026-04-05 20:47:03 +08:00
parent 305ef3eeee
commit 5fcf92d2da
5 changed files with 332 additions and 81 deletions

View File

@@ -1,7 +1,7 @@
<template>
<section class="app-main">
<transition name="fade-transform" mode="out-in">
<keep-alive :include="cachedViews">
<keep-alive :include="keepAliveInclude">
<router-view v-if="!$route.meta.link" :key="key" />
</keep-alive>
</transition>
@@ -21,6 +21,11 @@ export default {
cachedViews() {
return this.$store.state.tagsView.cachedViews
},
// cachedViews 为空时勿传 []Vue2 keep-alive 的 include 为 [] 会匹配不到任何组件,部分环境下首屏空白
keepAliveInclude() {
const list = this.cachedViews
return list && list.length ? list : undefined
},
key() {
return this.$route.path
}