swiper组件不轮播图片,只显示第一张图片
发布于 6 年前 作者 ahou 11706 次浏览 来自 官方Issues

https://developers.weixin.qq.com/miniprogram/dev/component/swiper.html

本来添加了四张图片,写了autoplay="true" indicator-dots="true" circular="true"

等属性 ,可是只显示第一张,而且也没轮播,求教呀QAQ

4 回复
楼主swiper

里面要嵌套swiper-item组件,4张图片需要4个swiper-item

是不是忘记啦?

参考代码:

            <swiper autoplay="true" bindchange="swiperChange" style="height: 500rpx">
              <block wx:for="{{imageUrls}}" wx:key="*this">
                <swiper-item>
                  <image src="{{item}}" class="slide-image" bindtap="previewImage"mode="aspectFill" lazy-load="{{true}}" />
                </swiper-item>
              </block>
            </swiper>

imageUrls:['xxx.jpg','yyyy.jpg']

好好学下数据绑定

不发代码的提问都是没有灵魂的。

回到顶部