0
点赞
收藏
分享

微信扫一扫

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

菜头粿子园 2022-03-30 阅读 90

微信小程序 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
}

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

举报

相关推荐

0 条评论