fix: 修复懒加载组件keep-alive不生效问题

This commit is contained in:
liumangmang
2026-03-30 16:41:16 +08:00
parent e895124831
commit ba1acdc2dd
2 changed files with 12 additions and 8 deletions

View File

@@ -190,10 +190,13 @@ function handleSftpTabClose(tabId: string, connectionId: number, event: Event) {
<div v-if="keepTerminalWorkspaceMounted" v-show="showTerminalWorkspace" class="h-full">
<TerminalWorkspaceView :visible="showTerminalWorkspace" />
</div>
<RouterView v-slot="{ Component }">
<keep-alive :include="['SftpView']" :max="10">
<component :is="Component" v-if="!showTerminalWorkspace" :key="$route.fullPath" />
</keep-alive>
<RouterView v-slot="{ Component, route }">
<template v-if="!showTerminalWorkspace">
<keep-alive :max="10" v-if="route.meta.keepAlive">
<component :is="Component" :key="route.fullPath" />
</keep-alive>
<component :is="Component" :key="route.fullPath" v-else />
</template>
</RouterView>
</main>
</div>