uni.getSystemInfo({
success: (res) => {
this.contentTop = res.safeArea.top
this.screenHeight = res.safeArea.height
console.log("res: " + JSON.stringify(res));
}
})
- 发布:2021-04-01 23:07
- 更新:2021-09-05 20:48
- 阅读:1373
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows 10专业版 19041.867
HBuilderX类型: 正式
HBuilderX版本号: 3.1.7
手机系统: Android
手机系统版本号: Android 11
手机厂商: 小米
手机机型: Redmi K20 Pro Premium Edition
页面类型: nvue
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
{"errMsg":"getSystemInfo:ok","brand":"Xiaomi","model":"Redmi K20 Pro Premium Edition","pixelRatio":2.75,"screenWidth":851,"screenHeight":393,"windowWidth":851,"windowHeight":393,"statusBarHeight":35,"language":"zh-CN","system":"11","version":"1.9.9.80770","fontSizeSetting":"","platform":"android","SDKVersion":"","windowTop":0,"windowBottom":0,"safeArea":{"left":0,"right":851,"top":35,"bottom":393,"width":851,"height":358},"safeAreaInsets":{"top":35,"right":0,"bottom":0,"left":0},"deviceId":"81EA8531377655EA08F729A46D2882E6"}
{"errMsg":"getSystemInfo:ok","brand":"Xiaomi","model":"Redmi K20 Pro Premium Edition","pixelRatio":2.75,"screenWidth":851,"screenHeight":393,"windowWidth":851,"windowHeight":393,"statusBarHeight":35,"language":"zh-CN","system":"11","version":"1.9.9.80770","fontSizeSetting":"","platform":"android","SDKVersion":"","windowTop":0,"windowBottom":0,"safeArea":{"left":0,"right":851,"top":35,"bottom":393,"width":851,"height":358},"safeAreaInsets":{"top":35,"right":0,"bottom":0,"left":0},"deviceId":"81EA8531377655EA08F729A46D2882E6"}
实际结果:
{"errMsg":"getSystemInfo:ok","brand":"Xiaomi","model":"Redmi K20 Pro Premium Edition","pixelRatio":2.75,"screenWidth":851,"screenHeight":393,"windowWidth":851,"windowHeight":393,"statusBarHeight":35,"language":"zh-CN","system":"11","version":"1.9.9.80770","fontSizeSetting":"","platform":"android","SDKVersion":"","windowTop":0,"windowBottom":0,"safeArea":{"left":0,"right":851,"top":35,"bottom":393,"width":851,"height":358},"safeAreaInsets":{"top":35,"right":0,"bottom":0,"left":0},"deviceId":"81EA8531377655EA08F729A46D2882E6"}
{"errMsg":"getSystemInfo:ok","brand":"Xiaomi","model":"Redmi K20 Pro Premium Edition","pixelRatio":2.75,"screenWidth":851,"screenHeight":393,"windowWidth":851,"windowHeight":393,"statusBarHeight":35,"language":"zh-CN","system":"11","version":"1.9.9.80770","fontSizeSetting":"","platform":"android","SDKVersion":"","windowTop":0,"windowBottom":0,"safeArea":{"left":0,"right":851,"top":35,"bottom":393,"width":851,"height":358},"safeAreaInsets":{"top":35,"right":0,"bottom":0,"left":0},"deviceId":"81EA8531377655EA08F729A46D2882E6"}
ace_cy (作者)
res: {"errMsg":"getSystemInfo:ok","brand":"Xiaomi","model":"Redmi K20 Pro Premium Edition","pixelRatio":2.75,"screenWidth":851,"screenHeight":393,"windowWidth":851,"windowHeight":393,"statusBarHeight":35,"language":"zh-CN","system":"11","version":"1.9.9.80770","fontSizeSetting":"","platform":"android","SDKVersion":"","windowTop":0,"windowBottom":0,"safeArea":{"left":0,"right":851,"top":35,"bottom":393,"width":851,"height":358},"safeAreaInsets":{"top":35,"right":0,"bottom":0,"left":0},"deviceId":"81EA8531377655EA08F729A46D2882E6"}
onReady获取到的也是一模一样的。注意看题目了吗?全面屏的安卓机,底部有一条小白条操作栏,获取到的安全高度,应该减去底部这一栏,或者你们提供一下获取底部操作栏高度的API?
2021-04-06 21:00