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); +}; + /** * 回上一页 */