From 140aba42f6c18aeffca70a9c609949eb1f9adf6d Mon Sep 17 00:00:00 2001 From: mackt <1033530438@qq.com> Date: Wed, 8 May 2024 13:44:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(Player=20Card):=20=E5=BC=B9=E5=87=BA=20Card?= =?UTF-8?q?=20=E6=97=B6=EF=BC=8C=E7=A6=81=E6=AD=A2=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/AudioPlayer/Player.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/components/AudioPlayer/Player.tsx b/src/components/AudioPlayer/Player.tsx index 3a510dc..cacb4e9 100644 --- a/src/components/AudioPlayer/Player.tsx +++ b/src/components/AudioPlayer/Player.tsx @@ -126,6 +126,15 @@ export default function AudioPlayer({ setVolume(value); }; + // 弹出 Card 时,禁止页面滚动 + useEffect(() => { + if (showCard) { + document.body.style.setProperty('overflow-y', 'hidden', 'important'); + } else { + document.body.style.removeProperty('overflow-y'); + } + }, [showCard]); + // 播放/暂停事件 useEffect(() => { audioRef.current.volume = volume / 100;