WeChat mini-program swiper component carousel diagram details and examples, mini-program swiper

Source: Internet
Author: User

Detailed description and examples of the carousel diagram of the mini-program swiper component, and the mini-program swiper

Small Program swiper component carousel Diagram

Try according to the development documentation, and always get something. before Android development, it was not easy to create a carousel image. We used viewpage and set up dots. After a while, there were a bunch of bugs. today, I was deeply touched by my tears when I tried to develop a small program for carousel images. the nonsense is over ,.


Is it a simple carousel image? It's very easy. 23333

The Code is also very simple.

1. index. wxml

<!--index.wxml-->    <swiper class="swiper" indicator-dots="true" autoplay="true" interval="5000" duration="1000">     <block wx:for="{{movies}}" wx:for-index="index">      <swiper-item>       <image src="{{item.url}}" class="slide-image" mode="aspectFill"/>      </swiper-item>     </block>    </swiper> 

Several attributes need to be described here.


<Block wx: for>

Here I traverse the movies [] array. <swiper-item> is the item

2. index. js

// Index. js // obtain the application instance var app = getApp () Page ({data: {movies: [{url: 'http: // im%4.tooopen.com/images/20130712/tooopen_17270713.jpg'}, {url: 'http: // response },{ url: 'http: // imipv4.tooopen.com/images/20130701/tooopen_20083555.jpg'}, {url: 'http: // response}]}, onLoad: function (){}})

3. WXML

/**index.wxss**/.swiper { height: 400rpx; width: 100%;}.swiper image { height: 100%; width: 100%;}

WXSS is not much said, it is no different from CSS.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.