From f0e2caf7a7124981eef6bc4ff9ed7b459893c102 Mon Sep 17 00:00:00 2001 From: streakingman Date: Thu, 22 Sep 2022 10:09:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20bgm=E5=8A=A0=E8=BD=BD=E6=97=B6=E6=9C=BA?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 4 ++-- src/App.tsx | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index e59b10c..ddb3297 100644 --- a/index.html +++ b/index.html @@ -31,8 +31,8 @@ // 如果您基于此项目二创,可以删除以下代码 // 否则请标明原仓库地址 setTimeout(()=>{ - const {host} = location - if(host!=='localhost'&&!host.endsWith('streakingman.com')){ + const {hostname} = location + if(hostname!=='localhost'&&!hostname.endsWith('streakingman.com')){ const a = document.createElement('a') a.setAttribute('href','https://github.com/StreakingMan/solvable-sheep-game') a.setAttribute('target','_blank') diff --git a/src/App.tsx b/src/App.tsx index c31e3d8..a9fd320 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -186,11 +186,14 @@ const App: FC = () => { // 主题切换 useEffect(() => { - setBgmOn(false); + // 初始化时不加载bgm + if (once) { + setBgmOn(false); + setTimeout(() => { + setBgmOn(true); + }, 300); + } restart(); - setTimeout(() => { - setBgmOn(true); - }, 300); }, [curTheme]); // 队列区排序