timg

微信小程序swiper禁止用户手指滑动

1.废话不多说直接上代码

wxml
<swiper class='yaohe' vertical='true' circular='true' autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
    <block wx:for='{{yaohe}}'>
      <swiper-item catchtouchmove='catchTouchMove'>   <!--重点这里-->
        <block wx:for='{{item}}'>
          <view class='yaohe_item'>
            <view class='yaohe_img'>
              <image src='{{item.goods_icon}}'></image>
            </view>
            <view class='yaohe_right'>
              <view class='yaohe_text'>{{item.goods_feature}}</view>
              <view class='boss_price'>
                <view class='price' bindtap='goGoodsDetail' data-shop_goods_id='{{item.shop_goods_id}}'>¥{{item.goods_price}}</view>
              </view>
            </view>
          </view>
        </block>
      </swiper-item>
    </block>
  </swiper>

 

// 阻止手指滑动
  catchTouchMove:function(res){
    return false
  }

 

如果插件对您有用,请随意打赏。您的支持将鼓励我做的更好!

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,你说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦