微信小程序高度自适应

 //  高度自适应(rpx)
    wx.getSystemInfo({
      success: function(res) {
        var clientHeight = res.windowHeight,  
          clientWidth = res.windowWidth,
          rpxR = 750 / clientWidth;    //比例
        var calc = clientHeight * rpxR;
        console.log(calc)
        that.setData({
          winHeight: calc
        });
      }
    });

 

你可能感兴趣的:(微信小程序)