s-hotzone-block.vue 873 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <view class="hotzone-wrap">
  3. <image :src="sheep.$url.cdn(data.imgUrl)" style="width: 100%" mode="widthFix"></image>
  4. <view
  5. class="hotzone-box"
  6. v-for="(item, index) in data.list"
  7. :key="index"
  8. :style="[
  9. {
  10. top: `${item.top}px`,
  11. left: `${item.left}px`,
  12. width: `${item.width}px`,
  13. height: `${item.height}px`,
  14. },
  15. ]"
  16. @tap.stop="sheep.$router.go(item.url)"
  17. >
  18. </view>
  19. </view>
  20. </template>
  21. <script setup>
  22. import sheep from '@/sheep';
  23. // 接收参数
  24. const props = defineProps({
  25. data: {
  26. type: Object,
  27. default: () => ({}),
  28. },
  29. styles: {
  30. type: Object,
  31. default: () => ({}),
  32. },
  33. });
  34. </script>
  35. <style lang="scss" scoped>
  36. .hotzone-wrap {
  37. position: relative;
  38. }
  39. .hotzone-box {
  40. position: absolute;
  41. }
  42. </style>