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

<view class="swiper" >
  </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 }) } }) },