From 234ea701b7d449def88ecf4352fd84c677612eba Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Thu, 9 Oct 2025 23:41:35 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E9=80=89=E6=8B=A9=E9=9A=BE=E5=BA=A6?= =?UTF-8?q?=E7=9A=84=E8=BF=94=E5=9B=9E=E6=8C=89=E9=92=AE=E7=94=A8=E4=B8=93?= =?UTF-8?q?=E9=97=A8=E7=9A=84=20magic=20number=20=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages-user/client-modules/src/render/ui/title.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages-user/client-modules/src/render/ui/title.tsx b/packages-user/client-modules/src/render/ui/title.tsx index d7d130a..2425988 100644 --- a/packages-user/client-modules/src/render/ui/title.tsx +++ b/packages-user/client-modules/src/render/ui/title.tsx @@ -38,7 +38,8 @@ import { adjustCover } from '../utils'; const enum TitleButton { StartGame, LoadGame, - Replay + Replay, + HardBack = -114514 } interface ButtonItem { @@ -126,7 +127,7 @@ export const GameTitle = defineComponent(props => { }); // 返回按钮 hard.push({ - code: main.levelChoose.length, + code: TitleButton.HardBack, color: '#aaa', name: '返回', hard: '', @@ -217,11 +218,11 @@ export const GameTitle = defineComponent(props => { */ const clickButton = (code: number) => { if (selectHard.value) { - if (code === hard.length - 1) { + if (code === TitleButton.HardBack) { toggleHard(); return; } - const item = hard[code]; + const item = hard.find(v => v.code === code)!; startGame(item.name); } else { switch (code) {