Home > Web Front-end > uni-app > How to disable sliding in uniapp swiper component

How to disable sliding in uniapp swiper component

coldplay.xixi
Release: 2023-01-13 00:44:22
Original
10824 people have browsed it

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">

How to disable sliding in uniapp swiper component

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">
Copy after login

js: The method implementation returns false

stopTouchMove: function() {
  return false;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template