swiper 组件 bindchange中调用setData,原先数据也会被渲染

发布于 7 年前作者 moqiang7900 次浏览最后编辑 7 年前来自 ask

在swiper 组件的 bindchange中调用setData()方法,没有改变的数据也会被重新渲染。

例如我只改变数据swipercurrentindex的值。

changswiperindex: function (event){
    this.setData({
      swipercurrentindex: event.detail.current
    })
  },

但是页面中其他的数据如recommendarray也被重新渲染,导致以下for循环执行。

<view class="recommendationview" wx:for="{{recommendarray}}" wx:key="id" >

1 回复
xia19
xia191 楼5 年前