hot-activity.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <script lang="ts" setup>
  2. import HotActivityItem from './hot-activity-item.vue'
  3. withDefaults(defineProps<{ items?: any[] }>(), { items: () => [] })
  4. const swiperList = [{}]
  5. const item = ref()
  6. const current = ref(0)
  7. onMounted(() => {
  8. console.log('mounted')
  9. nextTick(() => {
  10. console.log('nextTick')
  11. console.log(item.value)
  12. })
  13. })
  14. </script>
  15. <template>
  16. <view class="relative w-full box-border">
  17. <view class="relative h-full mx--2.5 mb--6 mt--1 box-border">
  18. <wd-img
  19. :width="'100%'"
  20. :height="'100%'"
  21. src="/static/svgs/vector.svg"
  22. mode="widthFix"
  23. ></wd-img>
  24. </view>
  25. <div class="absolute left-0 right-0 top-1 bottom-6 z-1 py-3.5">
  26. <div class="h-full w-full relative">
  27. <swiper class="" autoplay @change="(e) => (current = e.detail.current)">
  28. <template v-for="it of items" :key="it.id">
  29. <swiper-item class="">
  30. <HotActivityItem ref="item" :options="it.data" :type="it.type"></HotActivityItem>
  31. </swiper-item>
  32. </template>
  33. </swiper>
  34. </div>
  35. <div class="absolute top-2 left-1.5 flex justify-between">
  36. <wd-img
  37. custom-class="ms-1.5"
  38. src="/static/svgs/unnamed.svg"
  39. width="105px"
  40. mode="widthFix"
  41. ></wd-img>
  42. </div>
  43. <div class="absolute top-5 right-4 flex gap-1">
  44. <template v-for="(it, i) in items" :key="i">
  45. <div
  46. class="w-1 h-1 rounded-full"
  47. :class="`${current === i ? 'bg-white' : 'bg-white/40'}`"
  48. ></div>
  49. </template>
  50. </div>
  51. </div>
  52. </view>
  53. </template>