card-menu.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <script setup lang="ts">
  2. import Card from '@/components/card.vue'
  3. defineProps({
  4. customClass: {
  5. type: String,
  6. default: '',
  7. },
  8. items: {
  9. type: Array as PropType<
  10. {
  11. title: string
  12. desc?: string
  13. icon: string
  14. class: string
  15. colStart?: number
  16. colEnd?: number
  17. rowStart?: number
  18. rowEnd?: number
  19. iconSize?: number
  20. gridItemClass?: string
  21. }[]
  22. >,
  23. default: () => [],
  24. },
  25. })
  26. </script>
  27. <template>
  28. <view class="my-6 grid grid-gap-2.5" :class="customClass">
  29. <template v-for="it of items" :key="it.title">
  30. <div :class="it.gridItemClass">
  31. <card
  32. :custom-class="
  33. [
  34. it.class,
  35. 'flex flex-col justify-between items-center',
  36. it.colStart ? `col-start-${it.colStart}` : '',
  37. it.colEnd ? `col-end-${it.colEnd}` : '',
  38. it.rowStart ? `row-start-${it.rowStart}` : '',
  39. it.rowEnd ? `row-end-${it.rowEnd}` : '',
  40. ].join(' ')
  41. "
  42. >
  43. <div class="my-3.5 flex flex-col justify-start h-full">
  44. <div class="text-black/80 text-base font-normal font-['PingFang_SC'] leading-[10.18px]">
  45. {{ it.title }}
  46. </div>
  47. <div class="mt-1 text-black/40 text-xs font-normal font-['PingFang_SC'] leading-normal">
  48. {{ it.desc }}
  49. </div>
  50. </div>
  51. <view class="flex-1 w-full flex items-end justify-end">
  52. <wd-img :src="it.icon" :width="it.iconSize ?? 24" :height="it.iconSize ?? 24"></wd-img>
  53. </view>
  54. </card>
  55. </div>
  56. </template>
  57. </view>
  58. </template>