小程序获取顶部高度,设备信息和时间胶囊位置信息

 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
}
/*
SDKVersion: "2.18.0"
batteryLevel: 100
benchmarkLevel: 1
brand: "devtools"
deviceOrientation: "portrait"
devicePixelRatio: 3
enableDebug: true
fontSizeSetting: 15
language: "zh_CN"
model: "iPhone 6/7/8 Plus"
pixelRatio: 3
platform: "devtools"
safeArea: {top: 20, left: 0, right: 414, bottom: 736, width: 414, …}
screenHeight: 736
screenWidth: 414
statusBarHeight: 20
system: "iOS 10.0.1"
version: "8.0.5"
windowHeight: 688
windowWidth: 414
*/

wx.getMenuButtonBoundingClientRect(),//时间胶囊位置信息
获取菜单按钮(右上角胶囊按钮)的布局位置信息。坐标信息以屏幕左上角为原点。
/*
bottom: 56
height: 32
left: 320
right: 407
top: 24
width: 87
*/
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值