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

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);
      }
    })

猜你喜欢

转载自blog.csdn.net/G_wendy/article/details/82856462