这篇文章主要介绍了微信小程序 图片宽度自适应的实现的相关资料,需要的朋友可以参考下
微信小程序 图片宽度自适应的实现
实例代码:
wxml 代码:
1
2
3
4
5
6
7
<swiper indicator-dots=优质资源网点我wcqh.cn“{{indicatorDots}}” autoplay=”{{autoplay}}” interval=”{{interval}}” duration=”{{duration}}”>
<block w优质资源网点我wcqh.cnx:for=”{{imgUrls}}” wx:key=”image”>
<swiper-item>
<image src=”{{item.image}}” model=”aspectFit” style=优质资源网点我wcqh.cn“width: {{imageWidth}}px;” bindload=”imageLoad” />
</swiper-item>
</block>
</swiper>
JS 代码:
1
2
3
4
5
6
7
9
10
11
12
13
14
imageLoad: function () {
this.setData({
imageWidth: wx.getSystemInfoSync().windowWidth,//图片优质资源网点我wcqh.cn宽度
imgUrls: [
{ image: “http://img02.tooopen.com/images/20150928/tooopen_sy_143912755726.jpg” },
{ imag优质资源网点我wcqh.cne: “http://img06.tooopen.com/images/20160818/tooopen_sy_175866434296.jpg” },
{ image: “http://img06.t优质资源网点我wcqh.cnooopen.com/images/20160818/tooopen_sy_175833047715.jpg” }],
indicatorDots: false,//是否显示圆点
autoplay: tr优质资源网点我wcqh.cnue,//自动播放
interval: 2000,//间隔时间
duration: 1000//监听滚动和点击事件
})
}
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注PHP优质资源网点我wcqh.cn中文网!
相关推荐:
微信小程序如何实现image组件图片自适应宽度比例显示的方法
以上就是微信小程序中图片宽度自适应的实现的详细优质资源网点我wcqh.cn内容,更多请关注php中文网其它相关文章!
暂无评论内容