banner.vue 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <template>
  2. <view>
  3. <!-- 轮播图 circular-->
  4. <block v-if="list&&list.length>1">
  5. <swiper :style="'height:'+height+'rpx;'" class="swiper" circular :indicator-color="incolorh" :indicator-active-color="activecolorh" :indicator-dots="indicatorDotsh" :autoplay="autoplayh">
  6. <swiper-item v-for="(ite,idx) in list" :key="idx">
  7. <image :src="baseUrl+ite" class="bannerimg"></image>
  8. </swiper-item>
  9. </swiper>
  10. </block>
  11. <view class="swiper" :style="'height:'+height+'rpx;'" v-else>
  12. <image :src="baseUrl+list[0]" class="bannerimg"></image>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. import config from '@/config'
  18. export default {
  19. props:{
  20. list:{
  21. type: Array,
  22. default () {
  23. return []
  24. }
  25. },
  26. height:{
  27. type: [String,Number],
  28. default () {
  29. return '342'
  30. }
  31. }
  32. },
  33. data(){
  34. return{
  35. banner:require('@/static/images/home/banner.png'),
  36. autoplayh:false,
  37. incolorh:'#E6E6E6',
  38. activecolorh:'#A7A7A7',
  39. indicatorDotsh: true,
  40. baseUrl:config.baseUrl,
  41. }
  42. },
  43. onLoad: function() {
  44. },
  45. methods:{
  46. }
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .swiper{
  51. width: 100%;border-radius: 10rpx;overflow: hidden;
  52. image{width: 100%;height: 100%;}
  53. }
  54. .swiper /deep/ .uni-swiper-dot{width: 10rpx;height: 10rpx;}
  55. // .swiper /deep/ .uni-swiper-dot-active{width: 24rpx;height: 10rpx;}
  56. </style>