微信小程序swiper禁止用户手动滑动
生活随笔
收集整理的這篇文章主要介紹了
微信小程序swiper禁止用户手动滑动
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
用 catchtouchmove 事件來(lái)截獲用戶手動(dòng)滑動(dòng)事件,這樣既解決了禁用用戶手動(dòng)滑動(dòng),有解決了有點(diǎn)擊按鈕不影響使用
wxml
<swiper class='yaohe' vertical='true' circular='true' autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"><block wx:for='{{yaohe}}'><swiper-item catchtouchmove='catchTouchMove'> <!--重點(diǎn)這里--><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>重點(diǎn)js
// 截獲豎向滑動(dòng)catchTouchMove:function(res){return false}總結(jié)
以上是生活随笔為你收集整理的微信小程序swiper禁止用户手动滑动的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 小程序如何写tab选项卡
- 下一篇: 小程序swiper(tab)高度自适应