小程序轮播图中间大两边小

 不说这么多,直接上代码

 

        <swiper  class="swiper-block"  previous-margin="90rpx" next-margin="90rpx"  autoplay="{{yearOutoplay}}" current="0" circular='true' bindchange="yearSwiperChange" >
          <block wx:for="{{yearimgUrls}}" wx:index="{{index}}" wx:key=''>
            <swiper-item class="swiper-item">
              <image mode="aspectFill" src="{{item.url}}" class="slide-image {{swiperCurrent == index ? 'active' : ''}}"/>
            </swiper-item>
          </block>
        </swiper>

  

swiperCurrent: 0,
    yearOutoplay:false,
    yearimgUrls: [
      {
        url:'../../images/banner.jpg',
      },
      {
        url:'../../images/banner.jpg',
      },
      {
        url:'../../images/banner.jpg',
      },
    ],

 

yearSwiperChange(e) {
let current = e.detail.current;
let that = this;
that.setData({
swiperCurrent: current,
})
},

 

posted @ 2019-04-18 16:14  珺L  阅读(2657)  评论(0编辑  收藏  举报