banner.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="hometop">
  3. <swiper class="swiper" circular :indicator-active-color="activecolor" :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
  4. :duration="duration">
  5. <block v-for="(ite,idx) in bannerlist" :key='idx'>
  6. <swiper-item v-if="type=='zhong'&&ite.type==2">
  7. <image :src="baseUrl+ite.path" class="swiperimg"></image>
  8. </swiper-item>
  9. <swiper-item v-if="type=='zhao'&&ite.type==1">
  10. <image :src="baseUrl+ite.path" class="swiperimg"></image>
  11. </swiper-item>
  12. </block>
  13. </swiper>
  14. </view>
  15. </template>
  16. <script>
  17. import config from '@/config.js';
  18. const baseUrl = config.baseUrl;
  19. export default{
  20. props:{
  21. bannerlist:{
  22. type: Array,
  23. default () {
  24. return []
  25. }
  26. },
  27. type:{
  28. type: String,
  29. default () {
  30. return 'zhao'
  31. }
  32. },
  33. currentdate:{
  34. type: String,
  35. default () {
  36. return ''
  37. }
  38. }
  39. },
  40. data(){
  41. return{
  42. bannerimg:require("@/static/images/banner.png"),
  43. background: ['color1', 'color2', 'color3'],
  44. activecolor:'#ffffff',
  45. indicatorDots: true,
  46. autoplay: true,
  47. interval: 2000,
  48. duration: 500,
  49. baseUrl:''
  50. }
  51. },
  52. mounted() {
  53. this.baseUrl=baseUrl
  54. }
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .swiper{height: 412rpx;position: relative;
  59. .swiperimg{width: 100%;height: 100%;}
  60. }
  61. .swiper /deep/ .uni-swiper-wrapper .uni-swiper-dot{
  62. width:12rpx;height:12rpx;border-radius: 50%;background: rgba(0, 0, 0, 0.5);
  63. }
  64. .swiper /deep/ .uni-swiper-wrapper .uni-swiper-dot-active{
  65. width: 20rpx;height: 12rpx;border-radius: 6rpx;background-color: #ffffff;
  66. }
  67. // wx
  68. .swiper /deep/ .wx-swiper-wrapper .wx-swiper-dot{
  69. width:12rpx;height:12rpx;border-radius: 50%;background: rgba(0, 0, 0, 0.5);
  70. }
  71. .swiper /deep/ .wx-swiper-wrapper .wx-swiper-dot-active{
  72. width: 20rpx;height: 12rpx;border-radius: 6rpx;background-color: #ffffff;
  73. }
  74. .bannerfot{position: absolute;left: 0;right: 0;height: 70rpx;background-color: rgba(0, 0, 0, 0.5);padding: 0 32rpx;bottom: 0;display: flex;align-items: center;justify-content: space-between;}
  75. </style>