微信小程序 swiper禁止手动切换

微信小程序 swiper禁止手动切换

给swiper设置catchtouchmove为true,设置swiper-item的catchtouchmove返回false

<swiper
  class="swiper"
  indicator-dots="{{false}}"
  circular
  autoplay="{{true}}"
  vertical="{{true}}"
  interval="{{3000}}" 
  duration="{{300}}"
  easing-function="easeInOutCubic"
  catchtouchmove="true"
>
  <block wx:for="{{list}}" wx:key="index">
    <swiper-item catchtouchmove="stopChange">
      <view class="swiper-item">{{item.name}}</view>
    </swiper-item>
  </block>
</swiper>

stopChange() {
  return false
}

更多微信小程序知识点,查看

posted @ 2022-03-17 17:36  小菜菜爱吃菜  阅读(400)  评论(0编辑  收藏  举报