fix 修复移出道具 bug

This commit is contained in:
yupi 2022-09-18 00:09:22 +08:00
parent 06bc94fa1b
commit e57adbc824
2 changed files with 16 additions and 4 deletions

View File

@ -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;

View File

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