#小程序#获得屏幕高度,view高度

wxml中:

var query = wx.createSelectorQuery();
query.select('#getheight').boundingClientRect()
query.exec(function (res) {
  //console.log(res);
  console.log(res[0].height);
})

手机屏幕高度单位rpx:

 wx.getSystemInfo({
      success: function(res) {
        let h = 750 * res.windowHeight/res.windowWidth
         console.log(h);
      }
    })

 

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