梦学谷
梦学谷
  • 发布:2022-08-09 10:01
  • 更新:2022-08-25 16:04
  • 阅读:768

【报Bug】uni.getSystemInfoSync()获取的 screenHeight 和 windowHeight 值一样的

分类:uni-app

产品分类: 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

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,而不是导航高度,可能是这个原因导致的

2022-08-09 10:01 负责人:DCloud_UNI_LXH 分享
已邀请:
DCloud_UNI_WZF

DCloud_UNI_WZF

正常讲只有在没有 NavigationBar 和 TabBar 的时候 screenHeight 和 windowHeight 才会相等
方便贴下page.json->globalStyle 的配置或提供下测试工程吗

梦学谷

梦学谷 (作者)

uni.getSystemInfoSync().windowTop 获取的是0,这个应该有问题
从页导致 screenHeight 和 windowHeight 才会相等

pages [  
        {  
            "path" : "pages/my/my",  
            "style" :                                                                                      
            {  
                "navigationBarTitleText": "我的",  
                "enablePullDownRefresh": false  
            }  
        }  
],  
"globalStyle": {  
        // 状态栏与导航栏背景色  
        "navigationBarBackgroundColor":"#1966FF",  
        // 状态栏与导航栏字体颜色,black/white  
        "navigationBarTextStyle": "white",  
        // 上拉、下拉回弹背景色(ios真机微信小程序有效)  
        "backgroundColor": "#efeff4", // 下拉显示出来的窗口的背景色  
        "backgroundColorTop": "#efeff4", // 顶部窗口的背景色(bounce回弹区域)  
        "backgroundColorBottom": "#efeff4", // 底部窗口的背景色(bounce回弹区域)   
        // portrait竖屏,landscape横屏  
        "pageOrientation": "portrait"  
}
DCloud_UNI_LXH

DCloud_UNI_LXH

bug 已确认,预计下版修复

DCloud_UNI_LXH

DCloud_UNI_LXH

HBuilderX alpha 3.5.5 已修复

要回复问题请先登录注册