WeChat applet development slider view container

巴扎黑
Release: 2017-09-12 10:33:26
Original
2162 people have browsed it

微信小程序 开发之滑块视图容器详解

实现效果图:

WeChat applet development slider view container

实现起来特别简单,看看代码是怎么写的呢:

<swiper class="swiper" indicator-dots="pw_indcatorDots" autoplay="pw_autoPlay" interval="pw_interval" duration="pw_duration">
 <block wx:for="pw_imgUrls" wx:for-index="index">
  <swiper-item>
   <image src="pw_item" class="side-img"></image>
  </swiper-item>
 </block>
</swiper>
Copy after login

这就是布局了,看一下js里面代码:

Page({
  data: {
    imgUrls: [
      &#39;http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg&#39;,
      &#39;http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg&#39;,
      &#39;http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg&#39;],
    indcatorDots: true,
    autoPlay: true,
    interval: 5000,
    duration: 500
  },
Copy after login

,swiper有以下一些常用属性:

WeChat applet development slider view container

标记的两个属性暂时不管。

注意:其中只可放置组件,否则会导致未定义的行为。

swiper-item

仅可放置在组件中,宽高自动设置为100%。

就是这样,自己动手试试。

The above is the detailed content of WeChat applet development slider view container. 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!