獲取設備信息時得到的窗口高度寬度是px為單位的。 在實際使用時,一般使用rpx ,中間要有個轉換過程.
豌豆資源搜索網站https://55wd.com 電腦刺綉綉花廠 ttp://www.szhdn.com
代碼如下:
wx.getSystemInfo({
success:function (res) { console.log(res.windowHeight) // 獲取可使用窗口高度 let windowHeight = (res.windowHeight * (750 / res.windowWidth)); console.log(windowHeight) //獲得rpx單位的窗口高度 } })