<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
<block wx:for="{{imgUrls}}">
<swiper-item>
<navigator url="{{item.link}}" hover-class="navigator-hover">
<image src="{{item.url}}" class="slide-image"/>
</navigator>
</swiper-item>
</block>
</swiper>
swiper不能放在任何元素内部,否则轮播会出错
.slide-image{
width: 100%;
}
设置图片宽度铺满整个屏幕
data: {
imgUrls: [
{
link: '/pages/index/index',
url: 'http://www.wallcoo.com/holiday/2015%20New%20Year%2001/images/2015_celebrating_wallpaper_164701524.jpg'
}, {
link: '/pages/logs/logs',
url: 'http://www.wallcoo.com/holiday/2015%20New%20Year%2001/images/2015_celebrating_wallpaper_164701516.jpg'
}, {
link: '/pages/test/test',
url: 'http://www.wallcoo.com/holiday/2015%20New%20Year%2001/images/2015_celebrating_wallpaper_164701517.jpg'
}
],
// 是否需要底部轮播小点
indicatorDots: true,
// 是否自动播放
autoplay: true,
// 自动播放时间间隔
interval: 5000,
// 滑动动画时间
duration: 1000,
},
其中link为跳转的链接,URL为图片的地址,但是这个图片地址不能是本地地址,必须是线上图片地址或者base64为图片