swiper轮播图在安卓机会抖动的问题
发布于 6 年前 作者 jun37 4396 次浏览 来自 问答

请教各位大佬,最近做了一个在首页的轮播图,但是在安卓机上面会出现莫名其妙的抖动,初始以为是某个安卓机个体的问题,但是后来发现是很多安卓机都会出现这样的问题,请问该如何解决,球球

5 回复

问题解决了吗

不要去设置current就应该没问题。主要是bindschange事件会出现无限触发的情况。

或者在setData前,加一个current与e.detail.current的值做校验,相同就不要修改了。

这个问题解决了吗?

我也遇到了   咋解决

<view class="h-banner re">
    <!--banner  -->
    <swiper autoplay="{{autoplay}}" circular="{{circular}}" indicator-dots="true" current="{{currentSwiper}}" bindchange="swiperChange" loop="true">
      <block wx:for="{{imgs}}">
        <swiper-item>
          <image src="{{item}}"></image>
        </swiper-item>
      </block>
    </swiper>
    <!--重置小圆点的样式  -->
    <view class="dots">
      <block wx:for="{{imgs}}">
      <view class="dot{{index == currentSwiper ? ' active' : ''}}"></view>
      </block>
    </view>
  </view>
data: {
    imgs: [
      '../../img/01-banner.jpg',
      '../../img/01-banner.jpg'
    ],
    currentSwiper: 0,
    autoplay: true,
    circular:true,
    isIpx: false,//判断IPX
 
  },
  swiperChange: function (e) {
    var that=this;
    that.setData({
      currentSwiper: e.detail.current
    })
  },

提供下 代码片段呗

回到顶部