JS
that.setData({
slider: ['../../images/img01.jpg', '../../images/img02.jpg','../../images/img03.jpg']
})
WXML
<swiper id='sw' autoplay="auto" interval="5000" duration="500" indicator-dots='true' indicator-color='#00B26A'>
<block wx:for="{{slider}}" wx:key="id">
<swiper-item>
<image src='{{item}}'></image>
</swiper-item>
</block>
</swiper>
WXSS
#sw {
width: 100%;
height: 276rpx;
}
#sw swiper-item {
height: 100%;
width: 100%;
}
#sw swiper-item image {
height: 100%;
width: 100%;
}
更多可设定项
swiper 直通车
网友评论