banner_1.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="banner">
  3. <view class="banner_1">
  4. <swiper class="swiper" circular :indicator-dots="true" indicator-color="#ffffff"
  5. indicator-active-color="#FB1438" :interval="3000" :duration="1000">
  6. <swiper-item class="list" v-for="(item,index) in fileList" :key="index">
  7. <image class="image" :src="item.url" mode="aspectFit">
  8. </image>
  9. </swiper-item>
  10. </swiper>
  11. <!-- 是否关注商品 -->
  12. <view class="goodsColect">
  13. <text @tap="toGoodscolect"
  14. :class="['iconfont',goodsColect?'icon-yduishoucangshixin-copy':'icon-yduishoucangkongxin']"></text>
  15. </view>
  16. <view class="acttags" v-if="acttagsList.length>0">
  17. <text v-for="(i,indexx) in acttagsList" :key="indexx">{{i.label}}</text>
  18. </view>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. export default {
  24. props: {
  25. goodsInfo: {
  26. type: Object,
  27. },
  28. goodsColect: {
  29. type: Boolean
  30. }
  31. },
  32. data() {
  33. return {
  34. // 图片
  35. fileList: [],
  36. // 活动
  37. acttagsList: [],
  38. };
  39. },
  40. methods: {
  41. toGoodscolect() {
  42. const that = this;
  43. that.$emit('toGoodscolect')
  44. }
  45. },
  46. watch: {
  47. goodsInfo: {
  48. deep: true,
  49. immediate: true,
  50. handler(val) {
  51. if (val && val.file.length > 0) this.$set(this, `fileList`, val.file)
  52. if (val && val.act_tags.length > 0) this.$set(this, `acttagsList`, val.act_tags)
  53. }
  54. }
  55. },
  56. }
  57. </script>
  58. <style lang="scss">
  59. .banner {
  60. .banner_1 {
  61. border-bottom: 0.5vw solid var(--f9Color);
  62. swiper {
  63. height: 44vh !important;
  64. }
  65. .list {
  66. border-radius: 5px;
  67. .image {
  68. width: 100%;
  69. height: 100%;
  70. border-radius: 5px;
  71. background-color: #fff;
  72. }
  73. }
  74. .goodsColect {
  75. position: fixed;
  76. top: 2vw;
  77. right: 3vw;
  78. z-index: 99;
  79. background-color: #858585;
  80. border-radius: 90px;
  81. text {
  82. font-size: 30px;
  83. }
  84. }
  85. .acttags {
  86. position: absolute;
  87. top: 1vw;
  88. left: 1vw;
  89. width: 97%;
  90. text {
  91. display: inline-block;
  92. background-color: var(--fFB1Color);
  93. color: #fff;
  94. border-radius: 1vw;
  95. padding: 0.5vw;
  96. font-size: 12px;
  97. margin: 0 1vw 0 0;
  98. }
  99. }
  100. }
  101. }
  102. </style>