swiper swipet-item切换过快,会出现快速切换不断

2019-06-18  本文已影响0人  shaguamayi

<view :class="[{'on':curTab==0},'swiper-tab-list']" data-current="0" @click="swichNav('swichNav',event)"> <view class="swipertext">//上面的tab的判断不要跟下面的swiper写成相同的变量 <view class="imgwrap"> <image class='background' src="/static/images/gonggao2@2x.png" mode="aspectFill"></image> </view> <text>tab</text> </view> <view class="tringles" v-if="curTab==0"></view> </view> 其中一个tab //此处的currentTab不要在bindchange里面获取,在上面的tab单击事件中获取官方文档有写不要在bindchange里获取current的值,这样快速切换就不会一直出现疯狂切换的情况了 <swiper :current="currentTab" class="swiper-box" duration="300" @change="bindChange('bindChange',event)" >
<swiper-item id="noticeswiper">
</swiper-item>
</swiper>

bindChange(promp,e){
var that = this;
let oIndex = e.mp.detail.current;
this.curTab=oIndex
},
swichNav(propt,e){
var that = this;
let oIndex = e.mp.currentTarget.dataset.current;
this.currentTab = oIndex;
this.curTab=oIndex;

},

注:这是mpvue的写法

上一篇 下一篇

猜你喜欢

热点阅读