shop.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="shop" :class="'terminal' + terminal">
  3. <swiper class="swiper" :indicator-dots="false" :autoplay="true" @change="swiperChange">
  4. <swiper-item class="shop-item" v-for="(item,index) in imgList" :key="index">
  5. <div class="shop-item-warp">
  6. <img class="img" :src="item.img" mode="widthFix">
  7. <div class="a-link" @click="jumpLink(item.linkObj)">
  8. 进店逛逛<i class="iconfont icon-arrow-right"></i>
  9. </div>
  10. </div>
  11. </swiper-item>
  12. </swiper>
  13. <view class="swiper-dots" v-if="imgList && imgList.length">
  14. <text class="dot" :class="index === swiperCurrent && 'dot-active'" v-for="(dot, index) in imgList.length"
  15. :key="index"></text>
  16. </view>
  17. </div>
  18. </template>
  19. <script>
  20. // import { directive, Swiper, SwiperSlide } from 'vue-awesome-swiper'
  21. // import 'swiper/css/swiper.css'
  22. import {funMixin} from '../config/mixin'
  23. export default {
  24. name: 'shop',
  25. mixins: [funMixin],
  26. data () {
  27. return {
  28. swiperCurrent: 0,
  29. }
  30. },
  31. methods:{
  32. swiperChange(e) {
  33. this.swiperCurrent = e.detail.current;
  34. }
  35. },
  36. props: {
  37. terminal: {
  38. type: Number,
  39. default: 4
  40. },
  41. componentContent: {
  42. type: Object
  43. }
  44. },
  45. // components: {
  46. // Swiper,
  47. // SwiperSlide
  48. // },
  49. // directives: {
  50. // swiper: directive
  51. // },
  52. computed: {
  53. imgList: function () {
  54. return this.componentContent.imgTextData.filter(function (item) {
  55. return item.img
  56. })
  57. }
  58. }
  59. }
  60. </script>
  61. <style lang="scss" scoped>
  62. .shop{
  63. position: relative;
  64. .swiper{
  65. height: 460upx;
  66. }
  67. &-item{
  68. &-warp{
  69. position: relative;
  70. padding: 0 20upx;
  71. .img{
  72. width: 100%;
  73. height: 420upx;
  74. }
  75. .a-link{
  76. width: 220upx;
  77. height: 80upx;
  78. line-height: 80upx;
  79. background: linear-gradient(225deg, #585858 0%, #333333 100%);
  80. box-shadow: 0px 20upx 40upx rgba(0, 0, 0, 0.3);
  81. display: block;
  82. color: #fff;
  83. font-size: 28upx;
  84. text-align: center;
  85. position: absolute;
  86. right: 0;
  87. bottom: 30upx;
  88. .icon{
  89. margin-left: 20upx;
  90. }
  91. }
  92. }
  93. }
  94. //.pagination{
  95. // display: flex;
  96. // justify-content: center;
  97. // padding:20upx 0;
  98. // ::v-deep .swiper-pagination-bullet{
  99. // width: 12upx;
  100. // height: 12upx;
  101. // background: #333333;
  102. // border-radius: 50%;
  103. // opacity: 0.2;
  104. // margin: 0 10upx;
  105. // }
  106. // ::v-deep .swiper-pagination-bullet-active{
  107. // width: 24upx;
  108. // height: 12upx;
  109. // background: #333333;
  110. // opacity: 1;
  111. // border-radius: 8upx;
  112. // }
  113. //}
  114. //::v-deep .uni-swiper-dots{
  115. // display: flex;
  116. // justify-content: center;
  117. // padding: 0upx 0;
  118. // .uni-swiper-dot{
  119. // width: 10upx;
  120. // height: 10upx;
  121. // background: #333333;
  122. // opacity: 0.3;
  123. // border-radius: 5upx;
  124. // margin: 0 5upx;
  125. // &-active{
  126. // width: 20upx;
  127. // height: 10upx;
  128. // opacity: 1;
  129. // }
  130. // }
  131. //}
  132. .swiper-dots {
  133. display: flex;
  134. position: absolute;
  135. left: 50%;
  136. transform: translateX(-50%);
  137. bottom: 15rpx;
  138. z-index: 66;
  139. .dot {
  140. width: 10upx;
  141. height: 10upx;
  142. background: #333333;
  143. opacity: 0.3;
  144. border-radius: 5upx;
  145. margin: 0 10upx;
  146. }
  147. .dot-active {
  148. width: 20upx;
  149. opacity: 1;
  150. }
  151. }
  152. }
  153. </style>