banner.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <view>
  3. <view class="swiper-banner-content">
  4. <view class="swiper-banner-box">
  5. <swiper
  6. class="tui-banner-swiper tui-banner tui-skeleton-fillet"
  7. :autoplay="true"
  8. :interval="5000"
  9. :duration="500"
  10. @change="swiperChange"
  11. :circular="true"
  12. >
  13. <swiper-item v-for="(item, index) in list" :key="index" @click.stop="handleJumpLink(item)">
  14. <image :src="item.bannerImage" class="tui-slide-image" mode="scaleToFill" />
  15. </swiper-item>
  16. </swiper>
  17. <view class="swiper__dots-box" v-if="list.length > 1">
  18. <view
  19. v-for="(item, idx) in list"
  20. :key="idx"
  21. :class="[idx === current ? 'swiper__dots-long' : 'none']"
  22. :data-index="current"
  23. class="swiper__dots-item"
  24. >
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. import jumpMixins from '@/mixins/jumpMixins.js'
  33. export default {
  34. mixins: [jumpMixins],
  35. name: 'banner',
  36. props: {
  37. list: {
  38. type: Array
  39. }
  40. },
  41. data() {
  42. return {
  43. current: 0
  44. }
  45. },
  46. created() {
  47. console.log('list',this.list)
  48. },
  49. computed: {},
  50. methods: {
  51. swiperChange(e) {
  52. //轮播图切换
  53. const index = e.detail.current
  54. this.current = index
  55. },
  56. NavToDetailPage(floor) {
  57. //跳转
  58. // this.$api.FlooryNavigateTo(floor)
  59. uni.navigateTo({
  60. url: '/pages/goods/commonStoreIndex/index?id='+ floor.id + '&organizeId=' + floor.organizeId
  61. })
  62. }
  63. }
  64. }
  65. </script>
  66. <style lang="scss">
  67. .swiper-banner-content {
  68. width: 100%;
  69. height: auto;
  70. position: relative;
  71. background-size: cover;
  72. }
  73. .swiper-banner-box {
  74. width: 100%;
  75. height: 360rpx;
  76. position: relative;
  77. background-size: cover;
  78. }
  79. .tui-banner-swiper {
  80. width: 700rpx;
  81. margin: 0 auto;
  82. height: 340rpx;
  83. border-radius: 8rpx;
  84. overflow: hidden;
  85. transform: translateY(0);
  86. box-shadow: 0px 3px 6px rgba(225, 86, 22, 0.08);
  87. margin-top: 16rpx;
  88. .banner-item {
  89. border-radius: 8rpx;
  90. }
  91. .tui-slide-image {
  92. width: 100%;
  93. height: 340rpx;
  94. display: block;
  95. }
  96. }
  97. .swiper__dots-box {
  98. position: absolute;
  99. bottom: 40rpx;
  100. left: 0;
  101. right: 0;
  102. /* #ifndef APP-NVUE */
  103. display: flex;
  104. /* #endif */
  105. flex: 1;
  106. flex-direction: row;
  107. justify-content: center;
  108. align-items: center;
  109. .swiper__dots-item {
  110. width: 8rpx;
  111. height: 8rpx;
  112. border-radius: 100%;
  113. margin-left: 6px;
  114. background-color: rgba(255, 255, 255, 0.7);
  115. }
  116. .swiper__dots-long {
  117. width: 35rpx;
  118. height: 8rpx;
  119. border-radius: 4rpx;
  120. background-color: #ffff;
  121. transition: all 0.4s;
  122. }
  123. }
  124. </style>