itmonkey
itmonkey
  • 发布:2022-06-21 13:27
  • 更新:2022-07-29 17:28
  • 阅读:746

【报Bug】uni.getSystemInfoSync(),微信H5下,ios底部安全区域safeAreaInsets.bottom 为0,开发者工具有效,真机无效

分类:uni-app

产品分类: uniapp/H5

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: window11

HBuilderX类型: 正式

HBuilderX版本号: 3.4.17

浏览器平台: 微信内置浏览器

浏览器版本:

项目创建方式: HBuilderX

示例代码:
复制代码<view v-if="safeAreaInsetBottom" :style="[{ height: safeBottomHeight + 'px' }]"></view>  

    data() {  
        return {  
            placeholderHeight: 0,  
            safeBottomHeight: uni.getSystemInfoSync().safeAreaInsets.bottom  
        };  
    },

操作步骤:

使用ios 真机,测试下safeAreaInsets.bottom,高度为0

预期结果:

使用ios 真机,测试下safeAreaInsets.bottom,得到真实安全区域高度

实际结果:

使用ios 真机,测试下safeAreaInsets.bottom,高度为0

bug描述:

uni.getSystemInfoSync(),微信H5下,ios底部安全区域safeAreaInsets.bottom 为0,开发者工具有效,真机无效。
其他端正常,开发者工具正常,微信H5,ios真机不行

2022-06-21 13:27 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

vue2 还是 vue3?

项目是基于哪个模板做的吗?

  • itmonkey (作者)

    vue3,没有基于哪个版本,uni.getSystemInfoSync().safeAreaInsets.bottom,这个api开发者工具,小程序等平台都没问题,在ios微信H5,参数为0,ios12

    2022-06-23 11:13

  • DCloud_UNI_GSQ

    回复 itmonkey: 是否配置了模板html(https://uniapp.dcloud.io/collocation/manifest.html#h5-template),分析是没有配置viewport-fit=cover

    2022-06-23 11:23

老醒

老醒

应该是bug,我试了下"plus.navigator.getSafeAreaInsets()",拿到的数值里面deviceBottom正是之前能获取到的bottom

复制代码//异常  
{  
  "bottom": 0,  
  "deviceBottom": 34,  
  "deviceLeft": 0,  
  "deviceRight": 0,  
  "deviceTop": 48,  
  "left": 0,  
  "right": 0,  
  "top": 48  
}  
复制代码
//正常时  
{  
"platform": "ios",  
  "safeArea": {  
    "left": 0,  
    "right": 414,  
    "top": 48,  
    "bottom": 862,  
    "width": 414,  
    "height": 814  
  },  
  "safeAreaInsets": {  
    "top": 48,  
    "right": 0,  
    "bottom": 34,//和上面的deviceBottom一致  
    "left": 0  
  },  
  "screenHeight": 896,  
  "screenWidth": 414,  
}  

该问题目前已经被锁定, 无法添加新回复

  • 标题 / 粗斜体
  • 代码片段
  • 超链接 / 图片 / 视频
  • 列表 / 引用

文章内容较多时,可以用标题分段 :

## 大标题 
### 小标题

斜体 / 粗体 :

**粗体** 
*斜体*
***粗斜体***

代码片段 :

``` javascript
代码片段
```

超链接 :

[链接文字](链接地址) 例: [百度](http://www.baidu.com)

图片 :

![图片说明](图片地址) 例: ![百度logo](http://www.baidu.com/img/bdlogo.gif)

视频 :

!![视频说明](视频地址) 例: !![优酷视频](http://youku.com)

有序列表 :

1. 123
2. 123
3. 123

无序列表 :

- 123
- 123
- 123

引用 : ( 双回车后结束引用 )

> 引用内容
引用内容
引用内容