From e58891b53b4e5f08c8ec150b5055800b755cd049 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sat, 24 Jan 2026 15:24:21 +0800 Subject: [PATCH] =?UTF-8?q?fix(debug):=20=E4=BF=AE=E5=A4=8D=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E7=AA=97=E5=8F=A3=E7=9A=84=E6=97=A5=E5=BF=97=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/DebugComponent.vue | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/web/src/components/DebugComponent.vue b/web/src/components/DebugComponent.vue index 2ac7ad0e..0f131272 100644 --- a/web/src/components/DebugComponent.vue +++ b/web/src/components/DebugComponent.vue @@ -145,11 +145,20 @@ import { onUnmounted, nextTick, toRaw, - h + h, + watch } from 'vue' const showModal = defineModel('show') +// 监听 showModal 变化,当打开时获取日志 +watch(showModal, (isOpen) => { + if (isOpen) { + // 延迟一下确保 DOM 渲染完成 + setTimeout(fetchLogs, 100) + } +}) + import { useConfigStore } from '@/stores/config' import { useUserStore } from '@/stores/user' import { useDatabaseStore } from '@/stores/database' @@ -377,20 +386,15 @@ const handleFullscreenChange = () => { } onMounted(() => { - if (checkSuperAdminPermission()) { - fetchLogs() - } document.addEventListener('fullscreenchange', handleFullscreenChange) document.addEventListener('webkitfullscreenchange', handleFullscreenChange) document.addEventListener('msfullscreenchange', handleFullscreenChange) }) onActivated(() => { - if (!checkSuperAdminPermission()) return - if (state.autoRefresh) { toggleAutoRefresh(true) - } else { + } else if (showModal.value) { fetchLogs() } })