根据官方 source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制,只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
// 轮播change事件
swiperChange(e) {
console.log(e);
var _this = this;
var swiperIndex = e.detail.current;
var source = e.detail.source;
// console.log('轮播事件index'+index)
if(source == 'autoplay' || source == 'touch') {
_this.setData({
swiperIndex : index
})
}
},