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;