hotspot.vue 1.7 KB

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