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

用  catchtouchmove  事件来截获用户手动滑动事件,这样既解决了禁用用户手动滑动,有解决了有点击按钮不影响使用

贴代码:

WXML:

  1. <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='boss'>{{item.shop_name}}</view>
                    <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>

JS:

// 截获竖向滑动
  catchTouchMove:function(res){
    return false
  }