foodSelect.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <!-- 食物图标按钮 -->
  3. <view @click="handleOpen" class="food-btn-box"></view>
  4. <uni-popup ref="popupRef" type="bottom">
  5. <view class="game-popup-box">
  6. <view class="game-popup-head">
  7. <view class="game-popup-title"></view>
  8. <view class="jf-btn-box">
  9. <!-- 积分 -->
  10. <view class="ezy-jf-box game-popup-jf">
  11. <icon class="jf-icon"></icon>
  12. <text class="jf-text" >{{credit}}</text>
  13. </view>
  14. <!-- 关闭按钮 -->
  15. <icon class="popup-close-btn" @click="handleClose"></icon>
  16. </view>
  17. </view>
  18. <view class="food-list-box">
  19. <view v-for="item in foodSpeciesList" :key="item.id" @click="handleSelectFood(item)" class="food-item-box">
  20. <image :src="item.imgUrl" class="food-image"/>
  21. <view class="food-item-jf">
  22. <icon class="jf-icon"></icon>
  23. <text class="jf-text" >{{item.id}}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </uni-popup>
  29. </template>
  30. <script setup>
  31. import {foodSpeciesList} from './constantConfig';
  32. import {ref} from "vue";
  33. const emits = defineEmits(['weishi'])
  34. const props = defineProps({
  35. shiwuId: {
  36. type: [String,Number]
  37. },
  38. credit: {
  39. type: [String,Number]
  40. }
  41. })
  42. const popupRef = ref(null);
  43. function handleOpen() {
  44. popupRef.value.open();
  45. uni.$emit('food-select-open')
  46. }
  47. function handleClose() {
  48. popupRef.value.close();
  49. }
  50. function handleSelectFood(shiwu) {
  51. emits('weishi',shiwu);
  52. }
  53. defineExpose({
  54. handleClose
  55. })
  56. </script>
  57. <style>
  58. </style>