banner.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. .swiper-banner-content {
  65. width: 100%;
  66. height: auto;
  67. position: relative;
  68. background-size: cover;
  69. }
  70. .swiper-banner-box {
  71. width: 100%;
  72. height: 360rpx;
  73. position: relative;
  74. background-size: cover;
  75. }
  76. .tui-banner-swiper {
  77. width: 700rpx;
  78. margin: 0 auto;
  79. height: 340rpx;
  80. border-radius: 8rpx;
  81. overflow: hidden;
  82. transform: translateY(0);
  83. box-shadow: 0px 3px 6px rgba(225, 86, 22, 0.08);
  84. margin-top: 16rpx;
  85. .banner-item {
  86. border-radius: 8rpx;
  87. }
  88. .tui-slide-image {
  89. width: 100%;
  90. height: 340rpx;
  91. display: block;
  92. }
  93. }
  94. .swiper__dots-box {
  95. position: absolute;
  96. bottom: 40rpx;
  97. left: 0;
  98. right: 0;
  99. /* #ifndef APP-NVUE */
  100. display: flex;
  101. /* #endif */
  102. flex: 1;
  103. flex-direction: row;
  104. justify-content: center;
  105. align-items: center;
  106. .swiper__dots-item {
  107. width: 8rpx;
  108. height: 8rpx;
  109. border-radius: 100%;
  110. margin-left: 6px;
  111. background-color: rgba(255, 255, 255, 0.7);
  112. }
  113. .swiper__dots-long {
  114. width: 35rpx;
  115. height: 8rpx;
  116. border-radius: 4rpx;
  117. background-color: #ffff;
  118. transition: all 0.4s;
  119. }
  120. }
  121. </style>