food.vue 410 B

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