Home > Web Front-end > JS Tutorial > How to use the swiper component to switch image display in WeChat Mini Program

How to use the swiper component to switch image display in WeChat Mini Program

亚连
Release: 2018-06-21 11:57:40
Original
2152 people have browsed it

This article mainly introduces WeChat Xiaocheng's use of the swiper component to implement the image carousel switching display function, involving the use of related attributes of the swiper component, and comes with the source code for readers to download for reference. Friends in need can refer to it

This article describes the example of WeChat Xiaocheng using the swiper component to implement the image carousel switching display function. Share it with everyone for your reference, the details are as follows:

Key code

index.wxml:

<swiper indicator-dots="true"autoplay="true" interval="3000" duration="600" style="height:300px;">
 <swiper-item>
 <image src="../../pages/images/img1.png" style="display: block;height: 300px;"/>
 </swiper-item>
 <swiper-item>
 <image src="../../pages/images/img2.png" style="display: block;height: 300px;"/>
 </swiper-item>
 <swiper-item>
 <image src="../../pages/images/img3.png" style="display: block;height: 300px;"/>
 </swiper-item>
</swiper>
Copy after login

swiper component attribute description is as follows:

Attribute name Type Default value Description Minimum version
indicator-dots Boolean false Whether to display panel indicator dots
indicator-color Color rgba(0, 0, 0, .3) Indicator color 1.1.0
indicator-active-color Color #000000 The color of the currently selected indicator point 1.1.0
autoplay Boolean false Whether to switch automatically
current Number 0 The index of the current page
interval Number 5000 Automatic switching interval
duration Number 500 Sliding animation duration
circular Boolean false Whether to use connection sliding
vertical Boolean false Whether the sliding direction is vertical
bindchange EventHandle The change event will be triggered when current changes, event.detail = {current: current, source: source}

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

About ES6/JavaScript usage skills (detailed tutorial)

How to crawl website images in nodejs

About JS abstract factory pattern (detailed tutorial)

How to solve the conflict between Django and Vue syntax

The above is the detailed content of How to use the swiper component to switch image display in WeChat Mini Program. 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