第五篇、微信小程序-swiper组件
常用属性:

效果图:

swiper.wxml添加代码:
<swiper indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}} " bindchange="bindchangeTag">
<block wx:for="{{imgUrls}}">
<swiper-item>
<image src="{{item}}" class="slide-image"/>
</swiper-item>
</block>
</swiper>
<button bindtap="changeIndicatorDots"> 是否显示面板指示点 </button>
<button bindtap="changeAutoplay"> 是否自动切换 </button>
<slider bindchange="intervalChange" show-value min="1000" max="2000"/> 自动切换时间间隔
<slider bindchange="durationChange" show-value min="1800" max="10000"/> 滑动动画时长
js:
Page({
data: {
imgUrls: [
'http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg',
'http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg',
'http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg'
],
indicatorDots: false,
autoplay: false,
interval: 1000,
duration: 1800
},
//是否显示面板指示点
changeIndicatorDots: function(e) {
this.setData({
indicatorDots: !this.data.indicatorDots
})
},
//是否自动切换
changeAutoplay: function(e) {
this.setData({
autoplay: !this.data.autoplay
})
},
//自动切换时间间隔
intervalChange: function(e) {
this.setData({
// e.detail.value获取slider的值
interval: e.detail.value
})
},
//滑动动画时长
durationChange: function(e) {
this.setData({
duration: e.detail.value
})
},
//当页面改变是会触发
bindchangeTag:function(e){
console.log("bindchangeTag...")
},
onLoad:function(options){
// 页面初始化 options为页面跳转所带来的参数
},
onReady:function(){
// 页面渲染完成
},
onShow:function(){
// 页面显示
},
onHide:function(){
// 页面隐藏
},
onUnload:function(){
// 页面关闭
}
})
css:
.slide-image{
width: 100%;
height: 160px;
}
第五篇、微信小程序-swiper组件的更多相关文章
- 基于angular实现模拟微信小程序swiper组件
这段时间的主业是完成一个家政类小程序,终于是过审核发布了.不得不说微信的这个小程序生态还是颇有想法的,抛开他现有的一些问题不说,其提供的组件系统乍一看还是蛮酷的.比如其提供的一个叫swiper的视图组 ...
- 微信小程序 swiper 组件坑
swiper 组件高度被限制为150px了,所以内容无法撑开. 解决办法 给这组件重新设置个高度,然后在把里面的图片设置为自动适应容器大小.图片模式设置为 宽度不变 自动适应高度 <swiper ...
- 微信小程序--swiper组件
<view class='swiper-container'> <swiper indicator-dots="true" autoplay=" ver ...
- 微信小程序swiper组件实现图片宽度自适应
wxml 代码: <!--pages/swipe/swipe.wxml--> <view> <swiper circular="true" indic ...
- 微信小程序_(组件)swiper轮播图
微信小程序swiper轮播图组件官方文档 传送门 Learn: swiper组件 一.swiper组件 indicator-dots:是否显示面板指示点[默认值false] autoplay:是否自动 ...
- 微信小程序的组件总结
本文介绍微信小程序的组件 视图容器 基础内容 表单组件 导航组件 媒体组件 视图容器 view 布局容器 <view hover-class='bg'>222</view> 可 ...
- 微信小程序_(组件)scroll-view可滚动视图
微信小程序scroll-view组件官方文档 传送门 提前准备:使用<view>组件制作五条撑满的横向区域 <!--index.wxml--> Cynical丶Gary < ...
- 微信小程序picker组件两列关联使用方式
在使用微信小程序picker组件时候,可以设置属性 mode = multiSelector 意为多列选择,关联选择,当第一列发生改变时侯,第二列甚至第三列发生相应的改变.但是官方文档上给的只 ...
- 微信小程序swiper实现 句子控app首页滑动卡片
微信小程序swiper实现 句子控app首页滑动卡片 引言:最近看到句子控APP首页的效果很清新,可是发现他的微信小程序端没有实现这个功能,我看了一下难度不大,于是尝试着去实现. 实现效果如下: 1. ...
随机推荐
- OAuth 2.0
国外 OAuth2.0 大全:http://oauth.net/2/ 国内经典:http://www.fising.cn/2011/03/%E4%B8%80%E6%AD%A5%E4%B8%80%E6% ...
- 教你50招提升ASP.NET性能(十六):把问题仍给硬件而不是开发人员
(27)Throw hardware at the problem, not developers 招数27: 把问题仍给硬件而不是开发人员 As developers, we often want ...
- 配置文件struts2Struts2配置文件模块化包含(include)与action总结
本文是一篇关于配置文件struts2的帖子 <include>标签 当Struts配置文件比较多,需要模块化分别或分开成为多个配置文件时,这个功能比较好. 则需要使用<include ...
- HttpRequest
#ifndef __HTTP_REQUEST_H__ #define __HTTP_REQUEST_H__ #include "cocos2d.h" #include " ...
- GDI+与图形编程研究
GDI+的基本概念 GDI+的常用对象,包括Graphics.Font.Brush.Pen等对象的创建和使用 常用图形的绘制 Color结构.Point结构和Rectangle结构 1.GDI+的概念 ...
- Select模型原理
Select模型原理 利用select函数,推断套接字上是否存在数据,或者是否能向一个套接字写入数据.目的是防止应用程序在套接字处于锁定模式时,调用recv(或send)从没有数据的套接字上接收数据, ...
- 【linux设备模型】之platform设备驱动
一.platform总线.设备和驱动 platform是一种虚拟总线,对应的设备称为platform_device,对应的驱动称为platform_driver. platform_devic ...
- objective-c对NSArray的学习
转自:http://gekie.iteye.com/blog/1086256 NSARRAY简单的使用 定义数组,遍历数组: 1 2 3 4 5 6 7 8 NSArray *array; array ...
- proxy代理类
package cn.hncu.proxy.rent; import java.lang.reflect.InvocationHandler;import java.lang.reflect.Meth ...
- 程氏CMS去掉静态页面的隐藏性版权方法
程氏CMS去掉静态页面的隐藏性版权方法 实例如图: 因为之前自己找了好久都没找到这俩代码写在那个文件夹的,经过跟csqq8讨论了也没有得到结果,今天突然发现,原来这些代码都经过base64加密,用加密 ...