优化控制台与设置页切换时的 WebRTC 会话保活与恢复逻辑

This commit is contained in:
mofeng-git
2026-03-27 11:29:27 +08:00
parent 6bcb54bd22
commit 1c5288d783
3 changed files with 118 additions and 33 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { onMounted, watch } from 'vue'
import { KeepAlive, onMounted, watch } from 'vue'
import { RouterView, useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'
import { useSystemStore } from '@/stores/system'
@@ -56,5 +56,10 @@ watch(
</script>
<template>
<RouterView />
<RouterView v-slot="{ Component, route }">
<KeepAlive v-if="authStore.isAuthenticated">
<component :is="Component" v-if="route.name === 'Console'" />
</KeepAlive>
<component :is="Component" v-if="route.name !== 'Console' || !authStore.isAuthenticated" />
</RouterView>
</template>