]; 2. The js method returns false."/> ]; 2. The js method returns false.">

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

How to disable sliding in uniapp swiper component

coldplay.xixi
coldplay.xixiOriginal
2020-12-14 10:54:3510837browse

Uniapp swiper component method to prohibit sliding: 1. Add a method to [swiper-item], the code is [b1787cdbf9af81e57c7d2a4440195bc6]; 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">

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!

Statement:
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