index.vue 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <!-- 游戏页面 -->
  2. <template>
  3. <view class="ezy-game-page">
  4. <!-- 返回按钮 -->
  5. <view class="ezy-nav-bar-icon"></view>
  6. <!-- 积分 -->
  7. <view class="ezy-jf-box game-jf-box">
  8. <icon class="jf-icon"></icon>
  9. <text class="jf-text" >{{credit}}</text>
  10. </view>
  11. <!-- 桌面食物 -->
  12. <foodVue :shiwuId="shiwuId" class="food-img-box" :class="'food-img'+shiwuId"></foodVue>
  13. <!-- 大鹅 4阶段 -->
  14. <gooseVue :growth="growth" :growthType="growthType" :progress="progress"
  15. class="game-goose-box" :class="'game-goose-box'+ growthType"></gooseVue>
  16. <!-- 食物选择 -->
  17. <foodSelectVue ref="foodSelectRef" :shiwuId="shiwuId" @weishi="onWeiShi"></foodSelectVue>
  18. <!-- 游戏说明 -->
  19. <view class="yxsm-btn"></view>
  20. </view>
  21. </template>
  22. <script setup>
  23. import {ref} from "vue";
  24. import foodVue from "./components/food.vue";
  25. import gooseVue from "./components/goose.vue";
  26. import foodSelectVue from "./components/foodSelect.vue";
  27. import { useGame } from "./useGame";
  28. const { credit,growth,growthType,progress,shiwuId ,handleWeishi } = useGame();
  29. const foodSelectRef = ref(null);
  30. function onWeiShi(data) {
  31. handleWeishi(data.id, () => {
  32. foodSelectRef.value.handleClose();
  33. })
  34. }
  35. </script>
  36. <style>
  37. </style>