微信小程序swiper禁止用户手动滑动
生活随笔
收集整理的這篇文章主要介紹了
微信小程序swiper禁止用户手动滑动
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
用 catchtouchmove 事件來截獲用戶手動滑動事件,這樣既解決了禁用用戶手動滑動,有解決了有點擊按鈕不影響使用
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='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}總結
以上是生活随笔為你收集整理的微信小程序swiper禁止用户手动滑动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小程序如何写tab选项卡
- 下一篇: 小程序swiper(tab)高度自适应