index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <!-- 热区 -->
  3. <view class="diy-hotZone"
  4. :style="{ paddingBottom: `${itemStyle.paddingTop * 2}rpx`, background: itemStyle.background }">
  5. <view class="bg-image" :style="{ padding: `${itemStyle.paddingTop * 2}rpx ${itemStyle.paddingLeft * 2}rpx 0` }">
  6. <image class="image" :src="data.imgUrl" mode="widthFix"></image>
  7. </view>
  8. <view class="zone-item" v-for="(item, index) in data.maps" :key="index"
  9. :style="{ width: `${item.width}rpx`, height: `${item.height}rpx`, left: `${item.left}rpx`, top: `${item.top}rpx` }"
  10. @click="onLink(item.link)">
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import mixin from '../mixin'
  16. export default {
  17. /**
  18. * 组件的属性列表
  19. * 用于组件自定义设置
  20. */
  21. props: {
  22. itemIndex: String,
  23. itemStyle: Object,
  24. params: Object,
  25. data: Object
  26. },
  27. mixins: [mixin],
  28. /**
  29. * 组件的方法列表
  30. * 更新属性和数据的方法与更新页面数据的方法类似
  31. */
  32. methods: {
  33. }
  34. }
  35. </script>
  36. <style lang="scss" scoped>
  37. .diy-hotZone {
  38. position: relative;
  39. width: 100%;
  40. overflow: hidden;
  41. }
  42. .bg-image {
  43. width: 100%;
  44. z-index: 1;
  45. .image {
  46. display: block;
  47. width: 100%;
  48. }
  49. }
  50. .zone-item {
  51. position: absolute;
  52. z-index: 2;
  53. // background-color: red;
  54. }
  55. </style>