fix 修复移出道具 bug
This commit is contained in:
		| @@ -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; | ||||
|   | ||||
| @@ -47,7 +47,10 @@ | ||||
|         > | ||||
|           开始 | ||||
|         </a-button> | ||||
|         <a-button block @click="resetForm">重置</a-button> | ||||
|         <a-button block style="margin-bottom: 12px" @click="resetForm" | ||||
|           >重置 | ||||
|         </a-button> | ||||
|         <a-button block danger @click="resetConfig">还原最初配置</a-button> | ||||
|       </a-form-item> | ||||
|     </a-form> | ||||
|   </div> | ||||
| @@ -61,12 +64,13 @@ import { defaultGameConfig } from "../core/gameConfig"; | ||||
|  | ||||
| const formRef = ref<FormInstance>(); | ||||
| 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<any>(initConfig); | ||||
|  | ||||
| @@ -90,6 +94,14 @@ const resetForm = () => { | ||||
|   formRef?.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * 还原至初始配置 | ||||
|  */ | ||||
| const resetConfig = () => { | ||||
|   reset(); | ||||
|   router.go(0); | ||||
| }; | ||||
|  | ||||
| /** | ||||
|  * 回上一页 | ||||
|  */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user