wxml文件
<swiper class="bannerswiper" indicator-dots="true" autoplay="true" interval="5000" duration="1000">
<block wx:for="{{banner}}" wx:key="{{index}}">
<swiper-item>
<image src="{{item}}" class="slide-image" />
</swiper-item>
</block>
</swiper>
js文件
data: {
banner: [
'../../images/banner_1.png' ,//图片路径仅为示例(实际可从后台取出数据赋值给banner)
'../../images/banner_2.png'
]
},