获取设备信息时得到的窗口高度宽度是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单位的窗口高度 } })