index.vue 887 B

12345678910111213141516171819202122232425262728293031
  1. <!-- 游戏页面 -->
  2. <template>
  3. <!-- 积分 -->
  4. <view>{{credit}}</view>
  5. <!-- 桌面食物 -->
  6. <foodVue :shiwuId="shiwuId"></foodVue>
  7. <!-- 大鹅 4阶段 -->
  8. <gooseVue :growth="growth" :growthType="growthType" :progress="progress"></gooseVue>
  9. <!-- 食物选择 -->
  10. <foodSelectVue ref="foodSelectRef" :shiwuId="shiwuId" @weishi="onWeiShi"></foodSelectVue>
  11. </template>
  12. <script setup>
  13. import {ref} from "vue";
  14. import foodVue from "./components/food.vue";
  15. import gooseVue from "./components/goose.vue";
  16. import foodSelectVue from "./components/foodSelect.vue";
  17. import { useGame } from "./useGame";
  18. const { credit,growth,growthType,progress,shiwuId ,handleWeishi } = useGame();
  19. const foodSelectRef = ref(null);
  20. function onWeiShi(data) {
  21. handleWeishi(data.id, () => {
  22. foodSelectRef.value.handleClose();
  23. })
  24. }
  25. </script>
  26. <style>
  27. </style>