index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class='swiper'>
  3. <swiper :autoplay="autoplay" :circular="circular" :interval="interval" :duration="duration" @change="swiperChange">
  4. <block v-for="(item,index) in imgUrls" :key="index">
  5. <swiper-item>
  6. <navigator :url="item.link" style='width:100%;height:100%;' hover-class='none'><image :src="item.img" class="slide-image"/></navigator>
  7. </swiper-item>
  8. </block>
  9. </swiper>
  10. <view class="dots acea-row">
  11. <view class="dot" :class="index == currentSwiper ? 'active' : ''" v-for="(item,index) in imgUrls" :key="index"></view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. // +----------------------------------------------------------------------
  17. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  18. // +----------------------------------------------------------------------
  19. // | Copyright (c) 2016~2024 https://www.crmeb.com All rights reserved.
  20. // +----------------------------------------------------------------------
  21. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  22. // +----------------------------------------------------------------------
  23. // | Author: CRMEB Team <admin@crmeb.com>
  24. // +----------------------------------------------------------------------
  25. export default {
  26. props: {
  27. imgUrls: {
  28. type: Array,
  29. default: function(){
  30. return [];
  31. }
  32. }
  33. },
  34. data() {
  35. return {
  36. circular: true,
  37. autoplay: true,
  38. interval: 3000,
  39. duration: 500,
  40. currentSwiper: 0
  41. };
  42. },
  43. methods: {
  44. swiperChange: function (e) {
  45. this.currentSwiper = e.detail.current
  46. }
  47. }
  48. }
  49. </script>
  50. <style scoped lang="scss">
  51. .swiper{width:100%;height:282rpx;position:relative;}
  52. .swiper swiper{width:100%;height:100%;position:relative;}
  53. .swiper swiper .slide-image{width:100%;height:100%;}
  54. .swiper .dots{position:absolute;right:40rpx;bottom:20rpx;}
  55. .swiper .dots .dot{width:12rpx;height:12rpx;border:2rpx solid #fff;border-radius:50%;margin-right:15rpx;}
  56. .swiper .dots .dot.active{border-color:#e93323;background-color:#e93323;}
  57. </style>