【微信小程序】:实现轮播图3秒滚动

wxml模板:(数据一维数组)

<scroll-view  scroll-y="true">
      <swiper autoplay="auto" interval="3000" duration="500">
          <block wx:for="{{home_pics}}"  wx:for-index="index">
              <swiper-item>
                  <view class="ar_coverpath">
                    <image src="{{home_pics[index]}}" mode="aspectFill"/>
                </view>
              </swiper-item>
          </block>
      </swiper>
    </scroll-view>

wxml模板:(数据二维数组)

<scroll-view  scroll-y="true" style="height:{{scrollHeight}}px;" 
        class="list" bindscrolltolower="bindDownLoad" bindscroll="scroll" bindscrolltoupper="refresh">
    <swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
        <block wx:for="{{ad_list}}" wx:for-item="item" wx:for-index="index">
            <swiper-item>
                <image src="{{item.ad_file}}" class="slide-image" style="height:{{windowWidth * 0.375}}px !important"/>
            </swiper-item>
        </block>
    </swiper>
</scroll-view>

 

posted @ 2017-07-12 11:34  PHP急先锋  阅读(3996)  评论(0编辑  收藏  举报