From e57adbc82498c590ff34fe8c74e108ed92ef597c Mon Sep 17 00:00:00 2001 From: yupi <592789970@qq.com> Date: Sun, 18 Sep 2022 00:09:22 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E5=87=BA?= =?UTF-8?q?=E9=81=93=E5=85=B7=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/game.ts | 2 +- src/pages/ConfigPage.vue | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/core/game.ts b/src/core/game.ts index 9f55388..aae0b73 100644 --- a/src/core/game.ts +++ b/src/core/game.ts @@ -441,7 +441,7 @@ const useGame = () => { } // 槽移除块 for (let i = 0; i < slotAreaVal.value.length - 1; i++) { - slotAreaVal.value[i] = slotAreaVal.value[i - 1]; + slotAreaVal.value[i] = slotAreaVal.value[i + 1]; } // @ts-ignore slotAreaVal.value[slotAreaVal.value.length - 1] = null; diff --git a/src/pages/ConfigPage.vue b/src/pages/ConfigPage.vue index 2516ce7..d9534a7 100644 --- a/src/pages/ConfigPage.vue +++ b/src/pages/ConfigPage.vue @@ -47,7 +47,10 @@ > 开始 - 重置 + 重置 + + 还原最初配置 @@ -61,12 +64,13 @@ import { defaultGameConfig } from "../core/gameConfig"; const formRef = ref(); const router = useRouter(); -const { setGameConfig, setCustomConfig } = useGlobalStore(); +const { customConfig, setGameConfig, setCustomConfig, reset } = + useGlobalStore(); const initConfig = { - ...defaultGameConfig, randomAreaNum: 2, randomBlockNum: 8, animalStr: defaultGameConfig.animals.join(""), + ...customConfig, }; const config = reactive(initConfig); @@ -90,6 +94,14 @@ const resetForm = () => { formRef?.value?.resetFields(); }; +/** + * 还原至初始配置 + */ +const resetConfig = () => { + reset(); + router.go(0); +}; + /** * 回上一页 */