CardList.vue 807 B

123456789101112131415161718192021222324252627282930313233343536
  1. <script setup lang="ts">
  2. interface ListItem {
  3. img: string
  4. title: string
  5. desc: string
  6. time: string
  7. }
  8. const props = defineProps<{
  9. cardList: ListItem[]
  10. }>()
  11. </script>
  12. <template>
  13. <view
  14. v-for="(item, index) in props.cardList" :key="index" class="bg-[white] rounded-md shadow-lg mx-4 mb-4 w-[calc(100% - 32px)] mt-3"
  15. >
  16. <view class="flex">
  17. <image class="w-28 h-28 rounded-l-md" :src="item.img" />
  18. <view class="p-4">
  19. <view class="text-[14px]">
  20. {{ item.title }}
  21. </view>
  22. <view class="mt-2 text-[11px] text-[#999] whitespace-pre-line">
  23. {{ item.desc }}
  24. </view>
  25. <view class="mt-3 text-[10px] text-[#D8D8D8]">
  26. {{ item.time }}
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <style scoped>
  33. </style>