Uniapp swiper component method to prohibit sliding: 1. Add a method to [swiper-item], the code is [<swiper-item catchtouchmove="stopTouchMove">]; 2. The js method returns false . <swiper-item catchtouchmove="stopTouchMove">
The operating environment of this tutorial: windows7 system, uni-app2.5.1 version, thinkpad t480 computer.
How to disable sliding in the uniapp swiper component:
The swiper component implements horizontal sliding switching. Sometimes you just want to switch by clicking a button, and you need to disable manual sliding switching. You can use the following implementation method:
wxml: Add a method to swiper-item
<swiper-item catchtouchmove="stopTouchMove">
js: The method implementation returns false
stopTouchMove: function() { return false; }
Recommended (free): uni-app development tutorial
The above is the detailed content of How to disable sliding in uniapp swiper component. For more information, please follow other related articles on the PHP Chinese website!