fix: 修复懒加载组件keep-alive不生效问题
This commit is contained in:
@@ -190,10 +190,13 @@ function handleSftpTabClose(tabId: string, connectionId: number, event: Event) {
|
|||||||
<div v-if="keepTerminalWorkspaceMounted" v-show="showTerminalWorkspace" class="h-full">
|
<div v-if="keepTerminalWorkspaceMounted" v-show="showTerminalWorkspace" class="h-full">
|
||||||
<TerminalWorkspaceView :visible="showTerminalWorkspace" />
|
<TerminalWorkspaceView :visible="showTerminalWorkspace" />
|
||||||
</div>
|
</div>
|
||||||
<RouterView v-slot="{ Component }">
|
<RouterView v-slot="{ Component, route }">
|
||||||
<keep-alive :include="['SftpView']" :max="10">
|
<template v-if="!showTerminalWorkspace">
|
||||||
<component :is="Component" v-if="!showTerminalWorkspace" :key="$route.fullPath" />
|
<keep-alive :max="10" v-if="route.meta.keepAlive">
|
||||||
</keep-alive>
|
<component :is="Component" :key="route.fullPath" />
|
||||||
|
</keep-alive>
|
||||||
|
<component :is="Component" :key="route.fullPath" v-else />
|
||||||
|
</template>
|
||||||
</RouterView>
|
</RouterView>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ const routes: RouteRecordRaw[] = [
|
|||||||
path: 'sftp/:id',
|
path: 'sftp/:id',
|
||||||
name: 'Sftp',
|
name: 'Sftp',
|
||||||
component: () => import('../views/SftpView.vue'),
|
component: () => import('../views/SftpView.vue'),
|
||||||
|
meta: { keepAlive: true },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user