console.log("系统信息: " + JSON.stringify(uni.getSystemInfoSync()));
- 发布:2020-09-09 15:49
- 更新:2022-12-13 17:58
- 阅读:1749
产品分类: uniapp/小程序/微信
PC开发环境操作系统: Mac
PC开发环境操作系统版本号: 10.15.6
HBuilderX类型: 正式
HBuilderX版本号: 2.8.11
第三方开发者工具版本号: 1.03.2008270
基础库版本号: 2.13.0
项目创建方式: HBuilderX
示例代码:
操作步骤:
console.log("系统信息: " + JSON.stringify(uni.getSystemInfoSync()));
console.log("系统信息: " + JSON.stringify(uni.getSystemInfoSync()));
预期结果:
全面屏手机bottom应为实际安全区高度,非全面屏手机应为0
{
"model":"iPhone X",
"pixelRatio":3,
"windowWidth":375,
"windowHeight":724,
"system":"iOS 10.0.1",
"language":"zh_CN",
"version":"7.0.4",
"screenWidth":375,
"screenHeight":812,
"SDKVersion":"2.13.0",
"brand":"devtools",
"fontSizeSetting":16,
"benchmarkLevel":1,
"batteryLevel":60,
"statusBarHeight":44,
"safeArea":{
"right":375,
"bottom":812,
"left":0,
"top":44,
"width":375,
"height":768
},
"deviceOrientation":"portrait",
"platform":"devtools",
"devicePixelRatio":3,
"safeAreaInsets":{
"top":44,
"left":0,
"right":0,
"bottom": 34
}
}
全面屏手机bottom应为实际安全区高度,非全面屏手机应为0
{
"model":"iPhone X",
"pixelRatio":3,
"windowWidth":375,
"windowHeight":724,
"system":"iOS 10.0.1",
"language":"zh_CN",
"version":"7.0.4",
"screenWidth":375,
"screenHeight":812,
"SDKVersion":"2.13.0",
"brand":"devtools",
"fontSizeSetting":16,
"benchmarkLevel":1,
"batteryLevel":60,
"statusBarHeight":44,
"safeArea":{
"right":375,
"bottom":812,
"left":0,
"top":44,
"width":375,
"height":768
},
"deviceOrientation":"portrait",
"platform":"devtools",
"devicePixelRatio":3,
"safeAreaInsets":{
"top":44,
"left":0,
"right":0,
"bottom": 34
}
}
实际结果:
{
"model":"iPhone X",
"pixelRatio":3,
"windowWidth":375,
"windowHeight":724,
"system":"iOS 10.0.1",
"language":"zh_CN",
"version":"7.0.4",
"screenWidth":375,
"screenHeight":812,
"SDKVersion":"2.13.0",
"brand":"devtools",
"fontSizeSetting":16,
"benchmarkLevel":1,
"batteryLevel":60,
"statusBarHeight":44,
"safeArea":{
"right":375,
"bottom":812,
"left":0,
"top":44,
"width":375,
"height":768
},
"deviceOrientation":"portrait",
"platform":"devtools",
"devicePixelRatio":3,
"safeAreaInsets":{
"top":44,
"left":0,
"right":0,
"bottom":-88
}
}
{
"model":"iPhone X",
"pixelRatio":3,
"windowWidth":375,
"windowHeight":724,
"system":"iOS 10.0.1",
"language":"zh_CN",
"version":"7.0.4",
"screenWidth":375,
"screenHeight":812,
"SDKVersion":"2.13.0",
"brand":"devtools",
"fontSizeSetting":16,
"benchmarkLevel":1,
"batteryLevel":60,
"statusBarHeight":44,
"safeArea":{
"right":375,
"bottom":812,
"left":0,
"top":44,
"width":375,
"height":768
},
"deviceOrientation":"portrait",
"platform":"devtools",
"devicePixelRatio":3,
"safeAreaInsets":{
"top":44,
"left":0,
"right":0,
"bottom":-88
}
}
bug描述:
微信小程序中调用uni.getSystemInfoSync()获取的safeAreaInsets.bottom是负数,而且数值也不对。
3 个回复
一顾倾人诚
为什么 我也出现了负数的情况
instant
解决了吗,现在还是有负数
csd088
使用自定义导航好像就可以获取到正常值