wxml中:<view id='getheight'></view>
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);
}
})