swiper闪屏,闪的很快,不是每次都能出现!时好时坏,最近才发现的问题,这是什么原因!
<scroll-view class=‘main-banner’>
<swiper style=“height: 100%;” autoplay=‘true’ current="{{swiperCurrent}}" circular=“true” bindchange=“swiperChange”>
<block wx:for="{{bannerUrl}}" wx:key="{{this}}">
<swiper-item>
<image src="{{item.bannerImageUrl}}" mode=“scaleToFill” class=‘img-res’></image>
</swiper-item>
</block>
</swiper>
</scroll-view>
@LastLeaf 哦,那我把这段删了,就可以了吧
swiperChange: function (e) {
var that = this
that.setData({
swiperCurrent: e.detail.current
})
}
@LastLeaf 恩,又在onshow里重置了swiperCurrent
swiperChange: function (e) {
var that = this
that.setData({
swiperCurrent: e.detail.current
})
}
onShow: function () {
var that = this
that.setData({
swiperCurrent: ‘0’
})
}