foodSelect.vue 959 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <template>
  2. <!-- 食物图标按钮 -->
  3. <view @click="handleOpen">选择</view>
  4. <uni-popup ref="popupRef" type="bottom" border-radius="10px 10px 0 0" background-color="#fff">
  5. <view style="height: 300px;display: flex;justify-content: space-between;">
  6. <view v-for="item in foodSpeciesList" :key="item.id" @click="handleSelectFood(item)">
  7. <img style="width: 50px;height: auto;" :src="item.imgUrl">
  8. <text>{{item.credit}}</text>
  9. </view>
  10. </view>
  11. </uni-popup>
  12. </template>
  13. <script setup>
  14. import {foodSpeciesList} from './constantConfig';
  15. import {ref} from "vue";
  16. const emits = defineEmits(['weishi'])
  17. const props = defineProps({
  18. shiwuId: {
  19. type: [String,Number]
  20. }
  21. })
  22. const popupRef = ref(null);
  23. function handleOpen() {
  24. popupRef.value.open();
  25. }
  26. function handleClose() {
  27. popupRef.value.close();
  28. }
  29. function handleSelectFood(shiwu) {
  30. emits('weishi',shiwu);
  31. }
  32. defineExpose({
  33. handleClose
  34. })
  35. </script>
  36. <style>
  37. </style>