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

相关文章:

  • 2021-07-17
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
猜你喜欢
  • 2021-05-21
  • 2022-12-23
  • 2022-12-23
  • 2022-01-10
  • 2022-12-23
  • 2022-12-23
  • 2021-09-12
相关资源
相似解决方案