index.wxml
<view> <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> <block wx:for="{{imgUrls}}"> <swiper-item> <image src="{{item}}"></image> </swiper-item> </block> </swiper> </view>
index.js
Page({ data: { indicatorDots: true, autoplay: true, interval: 3000, duration: 1000, imgUrls: [ "../../images/1.png", "../../images/2.png", "../../images/3.png" ] } }