码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2018-03-06 15:10:16      阅读:167      评论:0      收藏:0      [点我收藏+]

标签:system   info   cti   小程序   idt   blog   bsp   log   nbsp   

<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 }) } }) },

 

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

标签:system   info   cti   小程序   idt   blog   bsp   log   nbsp   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!