goose.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view>
  3. <up-line-progress v-if="growthType!==3" :percentage="progress" :showText="false" activeColor="#54e1fe"
  4. class="game-progress-box"></up-line-progress>
  5. <text v-if="growthType!==3" class="game-progress-text">成长值:{{progress}}%</text>
  6. <image :src="imgUrl" class="goose-img-box" @click="handleTouch"></image>
  7. </view>
  8. </template>
  9. <script setup>
  10. import {
  11. ref,
  12. computed,
  13. watch,
  14. toRefs
  15. } from "vue";
  16. import upLineProgress from "uview-plus/components/u-line-progress/u-line-progress.vue";
  17. import {
  18. useAudio,
  19. useHuDong
  20. } from "./useAudio.js"
  21. const props = defineProps({
  22. growthType: {
  23. type: [String, Number]
  24. },
  25. progress: {
  26. type: [String, Number],
  27. default: 0
  28. }
  29. })
  30. const {growthType} = toRefs(props);
  31. const Emits = defineEmits(['onPlay','onEnd'])
  32. const {
  33. init,
  34. doTouch,
  35. imgUrl
  36. } = useHuDong(props);
  37. const {
  38. innerAudioContext,
  39. } = useAudio(growthType);
  40. init();
  41. watch(growthType, () => {
  42. init();
  43. })
  44. function handleTouch() {
  45. doTouch(innerAudioContext);
  46. }
  47. </script>
  48. <style>
  49. </style>