food.vue 424 B

123456789101112131415161718192021
  1. <template>
  2. <view>
  3. <image v-if="imgUrl" :src="imgUrl"></image>
  4. </view>
  5. </template>
  6. <script setup>
  7. import {foodSpeciesList} from './constantConfig';
  8. import { ref,computed } from "vue";
  9. const props = defineProps({
  10. shiwuId: [String,Number]
  11. })
  12. const imgUrl = computed(() => {
  13. const active = foodSpeciesList.find(item => item.id == props.shiwuId)
  14. return active ? active.imgUrl: ''
  15. })
  16. </script>
  17. <style>
  18. </style>