首页 > 其他 > 详细

小程序容器根据比例适应图片

时间:2018-03-06 15:03:06      阅读:238      评论:0      收藏:0      [点我收藏+]
<view class="swiper" style="height:{{sHeight}}px">
  </view>

 



imgLoad:function(){ var that = this; wx.getSystemInfo({ success: function (res) { // 获取设备宽度 var infoWidth = res.screenWidth-20; console.log(infoWidth) // 设置比例 var bili = 640/350; // 得到高度 var $height = infoWidth/bili; console.log($height) that.setData({ sHeight: $height }) } }) },

 

小程序容器根据比例适应图片

原文:https://www.cnblogs.com/zcboy/p/8514351.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!