微信小程序swiper组件实现图片宽度自适应
2017-06-28 10:38
946 查看
微信小程序 图片宽度自适应的实现
实例代码:
wxml 代码:
实例代码:
wxml 代码:
<swiper indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"> <block wx:for="{{imgUrls}}" wx:key="image"> <swiper-item> <image src="{{item.image}}" model="aspectFit" style="width: {{imageWidth}}px;" bindload="imageLoad" /> </swiper-item> </block> </swiper>JS 代码:
imageLoad: function () { this.setData({ imageWidth: wx.getSystemInfoSync().windowWidth,//图片宽度 imgUrls: [ { image: "http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg" }, { image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg" }, { image: "http://img06.tooopen.com/images/20160818/tooopen_sy_175833047715.jpg" }], indicatorDots: false,//是否显示圆点 autoplay: true,//自动播放 interval: 2000,//间隔时间 duration: 1000//监听滚动和点击事件 }) }
相关文章推荐
- 微信小程序swiper组件实现图片宽度自适应
- 微信小程序实现image组件图片自适应宽度比例显示的方法
- 微信小程序 图片宽度自适应的实现
- 微信小程序图片实现宽度100%,高度自适应
- 微信小程序图片实现宽度100%,高度自适应
- 微信小程序 Image 图片实现宽度100%,高度自适应
- 微信小程序例子——使用swiper组件实现图片切换
- 基于angular实现模拟微信小程序swiper组件
- 微信小程序实现图片自适应(支持多图)
- 微信小程序image图片自适应宽度比例显示的方法
- 微信小程序之swiper轮播图中的图片自适应高度
- 微信小程序image图片自适应宽度比例显示的方法
- 微信小程序使用swiper组件实现类3D轮播图
- 微信小程序实现图片高度自适应
- 微信小程序实现图片预加载组件
- 微信小程使用swiper组件实现图片轮播切换显示功能【附源码下载】
- 微信小程序image图片自适应宽度比例显示的方法
- 微信小程序之swiper轮播图中的图片自适应高度的方法
- 【小程序】<image>图片实现宽度100%时,高度自适应
- [微信小程序]根据图片宽高动态改变swiper(轮播图)组件宽高