let query = wx.createSelectorQuery();
query.select('元素class').boundingClientRect(rect=>{
  let height = rect.height;
  console.log("高度"+height+"px");
  //px转rpx
  let clientWidth = rect.width;
  let ratio = 750 / clientWidth;
  let height = clientHeight * ratio;
  console.log("高度"+height+"rpx");
}).exec();

原文地址:https://course.51qux.com/1868.html