微信小程序: wx.getSystemInfoSync()

try {
  const res = wx.getSystemInfoSync()
  console.log(res.model)     设备型号
  console.log(res.pixelRatio)   设备像素比
  console.log(res.windowWidth)
  console.log(res.windowHeight)
  console.log(res.language)
  console.log(res.version)    微信版本
  console.log(res.platform)   客户端平台
} catch (e) {
  // Do something when catch error
}
screenWidth: 整个屏幕宽度,单位px
screenHeight:整个屏幕高度,单位px

windowWidth:可使用窗口宽度,单位px
windowHeight:除导航栏外可使用窗口高度,单位px

 

posted @ 2021-11-18 09:59  云里知音  阅读(1305)  评论(0)    收藏  举报