1. 程式人生 > >微信小程序幻燈片代碼

微信小程序幻燈片代碼

實例 for src index 應用 blank eight component slide

1.index.wxml文件

<!--index.wxml-->

<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrls}}">
<swiper-item>
<image src="{{item}}" class="slide-image" width="355" height="350"/>
</swiper-item>
</block>
</swiper>

----------------------------

2.index.js 文件

//index.js
//獲取應用實例
var app = getApp()
Page({
data: {
imgUrls: [
‘../img/a1.jpg‘,
‘../img/a2.jpg‘,
‘../img/a3.jpg‘
],
indicatorDots: true,
autoplay: true,
interval: 5000,
duration: 1000
},

----------------------------

還有不明白的可以看:開發文檔

微信小程序幻燈片代碼