From a17a19fdc43c25fe1c493b4e3fd65b954f4f14a4 Mon Sep 17 00:00:00 2001 From: mmc <1556375442@qq.com> Date: Fri, 23 Oct 2026 12:42:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=20?= =?UTF-8?q?=E5=85=A8=E5=B1=8F=20=E4=B9=8B=E5=90=8E=20=E5=8F=91=E7=94=B5?= =?UTF-8?q?=E8=B6=8B=E5=8A=BF=20=20=E5=8F=98=E5=BD=A2=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 7bc80fb..d142003 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -48,10 +48,11 @@ export default function StationDashboard() { const el = powerTrendCardRef.current; if (!el) return; try { - if (!document.fullscreenElement) { - await el.requestFullscreen(); - } else { + // 只有当前全屏的是本卡片时才退出,否则请求卡片全屏(兼容页面整体全屏) + if (document.fullscreenElement === el) { await document.exitFullscreen(); + } else { + await el.requestFullscreen(); } } catch (err) { console.error('全屏切换异常:', err); @@ -65,7 +66,8 @@ export default function StationDashboard() { useEffect(() => { const onFullScreenChange = () => { - setIsPowerCardFullscreen(!!document.fullscreenElement); + // 只有发电趋势卡片本身全屏时才拉伸,页面整体全屏时保持原有尺寸 + setIsPowerCardFullscreen(document.fullscreenElement === powerTrendCardRef.current); }; document.addEventListener('fullscreenchange', onFullScreenChange); return () => { @@ -326,7 +328,7 @@ export default function StationDashboard() {