index.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <!-- 热区 -->
  3. <view class="diy-hotZone"
  4. :style="{ padding: `${itemStyle.paddingTop * 2}rpx ${itemStyle.paddingLeft * 2}rpx`, background: itemStyle.background }">
  5. <view class="bg-image" :style="{ borderRadius: `${itemStyle.borderRadius * 2}rpx` }">
  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. overflow: hidden;
  40. }
  41. .bg-image {
  42. overflow: hidden;
  43. z-index: 1;
  44. .image {
  45. display: block;
  46. width: 100%;
  47. }
  48. }
  49. .zone-item {
  50. position: absolute;
  51. z-index: 2;
  52. }
  53. </style>