hotspot.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view :style="[hotspotWrapStyle]">
  3. <view class="hotspot">
  4. <image :src="dataConfig.picStyle.url" mode="widthFix" class="image" :style="[imageRadius]"></image>
  5. <view v-for="(item, index) in dataConfig.picStyle.list" :key="item.number" :style="{
  6. top: `${item.starY}rpx`,
  7. left: `${item.starX}rpx`,
  8. width: `${item.areaWidth}rpx`,
  9. height: `${item.areaHeight}rpx`,
  10. }" class="area" @click="goPage(item.link)"></view>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. export default {
  16. props: {
  17. dataConfig: {
  18. type: Object,
  19. default: () => {}
  20. },
  21. isSortType: {
  22. type: String | Number,
  23. default: 0
  24. }
  25. },
  26. data() {
  27. return {}
  28. },
  29. computed: {
  30. imageRadius() {
  31. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  32. if (this.dataConfig.fillet.type) {
  33. borderRadius =
  34. `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
  35. }
  36. return {
  37. 'border-radius': borderRadius,
  38. };
  39. },
  40. hotspotWrapStyle() {
  41. return {
  42. 'padding': `${this.dataConfig.topConfig.val}rpx ${this.dataConfig.prConfig.val}rpx ${this.dataConfig.bottomConfig.val}rpx`,
  43. 'margin-top': `${this.dataConfig.mbConfig.val}rpx`,
  44. 'background': this.dataConfig.bottomBgColor.color[0].item,
  45. };
  46. },
  47. },
  48. methods: {
  49. goPage(link) {
  50. this.$util.JumpPath(link);
  51. },
  52. },
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .hotspot {
  57. position: relative;
  58. .image {
  59. display: block;
  60. width: 100%;
  61. }
  62. .area {
  63. position: absolute;
  64. }
  65. }
  66. </style>