uni.getSystemInfoSync().windowTop
当前结果0
uni.getSystemInfoSync().screenHeight
当前结果844
uni.getSystemInfoSync().windowHeight
当前结果844

- 发布:2022-08-09 10:01
- 更新:2025-04-01 16:59
- 阅读:1162
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: macos big sur
HBuilderX类型: 正式
HBuilderX版本号: 3.5.3
手机系统: iOS
手机系统版本号: iOS 15
手机厂商: 苹果
手机机型: iphone8/ iphone13
页面类型: vue
vue版本: vue3
打包方式: 云端
项目创建方式: HBuilderX
操作步骤:
预期结果:
uni.getSystemInfoSync().windowTop
当前结果0
uni.getSystemInfoSync().screenHeight
当前结果844
uni.getSystemInfoSync().windowHeight
当前结果844
uni.getSystemInfoSync().windowTop
当前结果0
uni.getSystemInfoSync().screenHeight
当前结果844
uni.getSystemInfoSync().windowHeight
当前结果844
实际结果:
uni.getSystemInfoSync().windowTop
当前结果0
uni.getSystemInfoSync().screenHeight
当前结果844
uni.getSystemInfoSync().windowHeight
当前结果844
uni.getSystemInfoSync().windowTop
当前结果0
uni.getSystemInfoSync().screenHeight
当前结果844
uni.getSystemInfoSync().windowHeight
当前结果844
bug描述:
HBuilderX版本号: 3.5.3.20220729
编译器版本:3.5.3(vue3)
vite v2.9.14 building for development
问题:
下面现象出现在IPhone IOS15中(H5是正常的,Android未测试是否有此问题)
uni.getSystemInfoSync() 获取的 screenHeight 和 windowHeight 值一样的,windowHeight 的值未将 NavigationBar 高度去除,
分析:uni.getSystemInfoSync().windowTop 获取到的是0,而不是导航高度,可能是这个原因导致的
7 个回复
DCloud_UNI_WZF
正常讲只有在没有 NavigationBar 和 TabBar 的时候 screenHeight 和 windowHeight 才会相等
方便贴下page.json->globalStyle 的配置或提供下测试工程吗
梦学谷 (作者)
uni.getSystemInfoSync().windowTop 获取的是0,这个应该有问题
从页导致 screenHeight 和 windowHeight 才会相等
DCloud_UNI_LXH
bug 已确认,预计下版修复
DCloud_UNI_LXH
HBuilderX alpha 3.5.5 已修复
南黎
麻烦看一下我的问题,这个问题还是没有修复,我的HbuilderX为最新版4.57
2025-04-01 17:01
南黎
在HbuilderX中新建的uniapp项目,vue3版本,setup语法糖,windowheight的值还是有问题,顶部windowTop还是为0
2025-04-01 17:06
南黎
在vue3的onload中不行,在onready就可以获取到,在vue2中onload中就可以,为什么
2025-04-01 17:11
2***@qq.com
4.15 版本编写uniappx也有这个问题
沈工
我没有啊
南黎 - 前端小渣渣
这个问题到现在还没有修复吗,第一张图为vue3,第二张为vue2
南黎
上图中的windowheight值就是不合适
2025-04-01 17:00
南黎
在vue3的onload中不行,在onready就可以获取到,在vue2中onload中就可以,为什么
2025-04-01 17:11