微信小程序中,如何禁止手动滑动 swiper 组件?

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/henryhu712/article/details/81411146

swiper 组件实现水平滑动切换,有时候只想通过点击按钮切换,需要禁用手动滑动切换。可以用下面的实现方法:

wxml:在 swiper-item 增加一个方法

<swiper-item catchtouchmove="stopTouchMove">

js:方法实现返回false

stopTouchMove: function() {
  return false;
}

猜你喜欢

转载自blog.csdn.net/henryhu712/article/details/81411146