slider.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <template>
  2. <view>
  3. <swiper :indicator-dots="propData.length > 0" :indicator-color="indicator_color" :indicator-active-color="indicator_active_color" :autoplay="propData.length > 0" :circular="circular" :class="'banner border-radius-main oh bg-white spacing-mb banner-'+(propSize || 'default')" v-if="propData.length > 0">
  4. <block v-for="(item, index) in propData" :key="index">
  5. <swiper-item>
  6. <image :src="item.images_url" mode="widthFix" :data-value="item.event_value || item.url" :data-type="item.event_type == undefined ? 1 : item.event_type" @tap="banner_event"></image>
  7. </swiper-item>
  8. </block>
  9. </swiper>
  10. </view>
  11. </template>
  12. <script>
  13. const app = getApp();
  14. export default {
  15. data() {
  16. return {
  17. indicator_dots: false,
  18. indicator_color: 'rgba(0, 0, 0, .2)',
  19. indicator_active_color: '#666',
  20. autoplay: true,
  21. circular: true
  22. };
  23. },
  24. components: {},
  25. props: {
  26. propData: {
  27. type: Array,
  28. default: []
  29. },
  30. propSize: {
  31. type: String,
  32. default: 'default'
  33. }
  34. },
  35. methods: {
  36. banner_event(e) {
  37. app.globalData.operation_event(e);
  38. }
  39. }
  40. };
  41. </script>
  42. <style>
  43. .banner {
  44. transform: translateY(0);
  45. }
  46. .banner image {
  47. min-width: 100%;
  48. }
  49. .banner-mini,
  50. .banner-mini image {
  51. height: 200rpx !important;
  52. }
  53. .banner-default,
  54. .banner-default image {
  55. height: 320rpx !important;
  56. }
  57. .banner-max,
  58. .banner-max image {
  59. height: 420rpx !important;
  60. }
  61. </style>