微信小程序_(组件)swiper轮播图
微信小程序swiper轮播图组件官方文档 传送门

Learn:
swiper组件
一、swiper组件
indicator-dots:是否显示面板指示点【默认值false】
autoplay:是否自动切换【默认值false】
interval:自动切换时间间隔【默认值5000】
duration:滑动动画时长【默认值500】
swiper滑块组件代码,初始化indicator-dots,autoplay,interval,duration四个属性
<swiper
indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}"
interval="{{interval}}"
duration="{{duration}}"
>
<block wx:for="{{imgUrls}}" wx:key="">
<swiper-item>
<image src="{{item}}" class="slide-image" width="355" height="150" />
</swiper-item>
</block>
</swiper>
添加<button>组件绑定函数,去修改indicator-dots,autoplay,interval,duration四个属性
<button bindtap="changeIndicatorDots">indicator-dots</button>
<button bindtap="changeAutoplay">autoplay</button>
interval自动切换时间间隔
<slider bindchange="intervalChange" show-value min="500" max="2000" />
duration滑动动画时长
<slider bindchange="durationChange" show-value min="1000" max="10000" />

<!--index.wxml-->
Cynical丶Gary
<!-- 建立swiper代码块 -->
<swiper
indicator-dots="{{indicatorDots}}"
autoplay="{{autoplay}}"
interval="{{interval}}"
duration="{{duration}}"
>
<block wx:for="{{imgUrls}}" wx:key="">
<swiper-item>
<image src="{{item}}" class="slide-image" width="355" height="150" />
</swiper-item>
</block>
</swiper> <button bindtap="changeIndicatorDots">indicator-dots</button>
<button bindtap="changeAutoplay">autoplay</button>
interval自动切换时间间隔
<slider bindchange="intervalChange" show-value min="500" max="2000" />
duration滑动动画时长
<slider bindchange="durationChange" show-value min="1000" max="10000" />
index.html
Page({
data: {
imgUrls: [
'https://images.unsplash.com/photo-1551334787-21e6bd3ab135?w=640',
'https://images.unsplash.com/photo-1551214012-84f95e060dee?w=640',
'https://images.unsplash.com/photo-1551446591-142875a901a1?w=640'
],
indicatorDots: false,
autoplay: false,
interval: 5000,
duration: 1000
},
changeIndicatorDots(e) {
this.setData({
indicatorDots: !this.data.indicatorDots
})
},
changeAutoplay(e) {
this.setData({
autoplay: !this.data.autoplay
})
},
intervalChange(e) {
this.setData({
interval: e.detail.value
})
},
durationChange(e) {
this.setData({
duration: e.detail.value
})
}
})
index.js
微信小程序_(组件)swiper轮播图的更多相关文章
- 微信小程序中自定义swiper轮播图面板指示点的样式
重置样式: .swiper{ width: 100%; height: 240px; margin-bottom: 0.5rem; position:relative; } div.wx-swiper ...
- 【云开发】10分钟零基础学会做一个快递查询微信小程序,快速掌握微信小程序开发技能(轮播图、API请求)
大家好,我叫小秃僧 这次分享的是10分钟零基础学会做一个快递查询微信小程序,快速掌握开发微信小程序技能. 这篇文章偏基础,特别适合还没有开发过微信小程序的童鞋,一些概念和逻辑我会讲细一点,尽可能用图说 ...
- 【微信小程序】:实现轮播图3秒滚动
wxml模板:(数据一维数组) <scroll-view scroll-y="true"> <swiper autoplay="auto" i ...
- 微信小程序_(组件)icon、text、rich-text、progress四大基础组件
微信小程序基础组件官方文档 传送门 Learn 一.icon图标组件 二.rich-text富文本组件 三.text文本组件 四.progress进度条组件 一.icon图标组件 type:icon的 ...
- 微信小程序_(组件)可拖动movable-view
微信小程序movable-view组件官方文档 传送门 Learn 一.moveable-view组件 一.movable-view组件 direction:movable-view的移动方向,属性值 ...
- 微信小程序_(组件)scroll-view可滚动视图
微信小程序scroll-view组件官方文档 传送门 提前准备:使用<view>组件制作五条撑满的横向区域 <!--index.wxml--> Cynical丶Gary < ...
- 微信小程序_(组件)view视图容器
微信小程序view组件官方文档 传送门 Learn 一.hover-class属性 二.hover-start-time与hover-stay-time属性 三.hover-stop-propagat ...
- 微信小程序_(组件)picker
picker组件效果 官方文档:传送门 Page({ data: { array: ['美国', '中国', '巴西', '日本'], objectArray: [ { id: 0, name: '美 ...
- 微信小程序_(组件)组件基础
(progress.text.block) 组件基础效果 官方文档:传送门 Page({ /** * 页面的初始数据 */ data: { text:"Gary 微信小程序\n", ...
随机推荐
- DPI,像素,英寸的关系
DPI * 英寸 = 像素 eg:在150dpi打印 (2 x 4)英寸的照片 等到多少像素的图像 (150*2)x (150*4) =300 x 600像素 同理可得 已知像素.英寸大小 求DPI ...
- VLC播放各种源
RTSP rtsp://admin:Shws1610@192.168.1.33:554/channel/01 UDP 播放推导本机上的udp流 : udp://@:1234 播放其他机器上的ud ...
- a标签 href不跳转 禁止跳转
当页面中a标签不需要任何跳转时,从原理上来讲,可分如下两种方法: 标签属性href,使其指向空或不返回任何内容.如: <a href="javascript:void(0);" ...
- OSCP-Kioptrix2014-3 后渗透测试
拿到root权限 之前的努力,最终获得了两个session 尝试看看该操作系统的漏洞 kali: searchsploit freebsd 9.0 cp /usr/share/exploitdb/ex ...
- BAT面试笔试33题:JavaList、Java Map等经典面试题!答案汇总!
JavaList面试题汇总 1.List集合:ArrayList.LinkedList.Vector等. 2.Vector是List接口下线程安全的集合. 3.List是有序的. 4.ArrayLis ...
- Hyperledger Fabric(5)ChainCode的编写步骤
链码(chaincode) 会对 Fabric应用程序 发送的交易做出响应,执行代码逻辑,与 账本 进行交互. 再复习下他们之间的逻辑关系: Hyperledger Fabric 中,Chainco ...
- 一步步创建第一个Vue项目
写在了GitHub https://github.com/TaoPanfeng/vue-cms 1 初始化 创建一个文件夹 vue-cms 在vue-cms目录下创建文件 package.json 在 ...
- 记录--js中出现的数组排序问题
这是今天在写vue项目时发生的一个小问题,在此记录一下,方便自己的回顾.项目是前后端分离的,前台主要使用了vue-cli3.0 + mintui,是一个移动端的web app包括了后台发布管理的一些功 ...
- ffmpeg生成视频封面图
ffmpeg 是一个视频处理软件 php-ffmpeg 是一个让 php 可以操作 ffmpeg 的 php插件,封装好了各种操作视频的名命令.直接调用对应的方法即可. 使用过程很曲折也很简单 曲折在 ...
- MySQL8.x msi版安装教程
一.下载MySQL 官网下载地址 https://dev.mysql.com/downloads/windows/installer/8.0.html 下载第二个即可(虽然只有32位的 但是会同时安 ...