wxml 代码
<swiper circular="{{circular}}" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" indicator-color="{{indicatorColor}}" indicator-active-color="{{indicatorActiveColor}}">
<block wx:for="{{imgUrls}}" wx:key="key">
<swiper-item>
<image src="{{item.img_path}}"></image>
</swiper-item>
</block>
</swiper>
js代码
Page({
data: {
circular: true, //是否开启无限轮播,衔接
indicatorDots: true, //是否显示面板指示点
autoplay: true, //是否自动播放
interval: 3000, //自动切换时间间隔
duration: 1000, //滑动动画时长
indicatorColor: "#eee", //普通轮播点背景色
indicatorActiveColor: "#f10215", //选中轮播点背景色
imgUrls: [{
'img_path': '/img/image/16pic_8581625_b.jpg'
},
{
'img_path': '/img/image/tupian.jpg'
},
{
'img_path': '/img/image/16pic_8581625_b.jpg'
},
]