1. <swiper indicator-dots="{{indicatorDots}}"
    2. autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
    3. <block wx:for="{{imgUrls}}">
    4. <swiper-item>
    5. <navigator url="{{item.link}}" hover-class="navigator-hover">
    6. <image src="{{item.url}}" class="slide-image"/>
    7. </navigator>
    8. </swiper-item>
    9. </block>
    10. </swiper>

    swiper不能放在任何元素内部,否则轮播会出错

    1. .slide-image{
    2. width: 100%;
    3. }

    设置图片宽度铺满整个屏幕

    1. data: {
    2. imgUrls: [
    3. {
    4. link: '/pages/index/index',
    5. url: 'http://www.wallcoo.com/holiday/2015%20New%20Year%2001/images/2015_celebrating_wallpaper_164701524.jpg'
    6. }, {
    7. link: '/pages/logs/logs',
    8. url: 'http://www.wallcoo.com/holiday/2015%20New%20Year%2001/images/2015_celebrating_wallpaper_164701516.jpg'
    9. }, {
    10. link: '/pages/test/test',
    11. url: 'http://www.wallcoo.com/holiday/2015%20New%20Year%2001/images/2015_celebrating_wallpaper_164701517.jpg'
    12. }
    13. ],
    14. // 是否需要底部轮播小点
    15. indicatorDots: true,
    16. // 是否自动播放
    17. autoplay: true,
    18. // 自动播放时间间隔
    19. interval: 5000,
    20. // 滑动动画时间
    21. duration: 1000,
    22. },

    其中link为跳转的链接,URL为图片的地址,但是这个图片地址不能是本地地址,必须是线上图片地址或者base64为图片