sheep/src/pages/IndexPage.vue
2022-09-16 22:17:31 +08:00

68 lines
1.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div id="indexPage">
<h1>🐟 鱼了个鱼</h1>
<div style="margin-bottom: 16px">低配版羊了个羊小游戏仅供消遣</div>
<a-button
block
style="margin-bottom: 16px"
@click="toGamePage(easyGameConfig)"
>
简单模式
</a-button>
<a-button
block
style="margin-bottom: 16px"
@click="toGamePage(middleGameConfig)"
>
中等模式
</a-button>
<a-button
block
style="margin-bottom: 16px"
@click="toGamePage(hardGameConfig)"
>
困难模式
</a-button>
<a-button
block
style="margin-bottom: 16px"
@click="toGamePage(lunaticGameConfig)"
>
地域模式
</a-button>
<a-button block style="margin-bottom: 16px" @click="toGamePage(null)">
自定义
</a-button>
</div>
</template>
<script setup lang="ts">
import { useRouter } from "vue-router";
import {
easyGameConfig,
middleGameConfig,
hardGameConfig,
lunaticGameConfig,
} from "../core/gameConfig";
import { useGlobalStore } from "../core/globalStore";
const router = useRouter();
const { setGameConfig } = useGlobalStore();
const toGamePage = (config?: GameConfig) => {
if (config) {
setGameConfig(config);
router.push("/game");
} else {
router.push("/config");
}
};
</script>
<style scoped>
#indexPage {
text-align: center;
}
</style>