wxml

 

<swiper indicator-dots autoplay interval='3000'>
<swiper-item wx:for="{{swipertItems}}" wx:key="*this">
<image src="{{item}}" mode="aspectFill" />
</swiper-item>
</swiper>

wxss

swiper {
width: 100%;
height: 200px;
background: #f0f0f0;
}

swiper-item image {
width: 100%;
height: 100%;
}

js

Page({ 
data: {
swipertItems: [
'http://www.shuzhiqiang.com/test/img/1.jpg', 'http://www.shuzhiqiang.com/test/img/2.jpg',
'http://www.shuzhiqiang.com/test/img/3.jpg',
'http://www.shuzhiqiang.com/test/img/4.jpg',
'http://www.shuzhiqiang.com/test/img/5.jpg',
],
},
})

【微信小程序】之轮播图、swiper、swiper-item、banner组件使用_轮播图