问题:组件swiper(轮播图)真机上不自动滚动 一直卡在那里抖动,后台运行几分钟,重新进入的时候也会抖动,问题复隐复现。
原代码:
// 轮播图圆点
swiperChange: function (e) {
this.setData({
currentSwiper: e.detail.current
})
解决方式:
if(source === '
autoplay'
|| source === '
touch'
) {
//根据source 来进行判断swiper的change事件是通过什么来触发的,autoplay是自动轮播。touch是用户手动滑动。其他的就是未知问题。抖动问题主要由于未知问题引起的,所以做了限制,只有在自动轮播和用户主动触发才去改变current值,达到规避了抖动bug
this
.setData({
currentSwiper: e.detail.current
})
}