安全区域
getSafeArea()
Section titled “getSafeArea()”获取安全区域信息(从 UserAgent 解析),用于适配刘海屏、全面屏等设备。
const safeArea = SuperSDK.getSafeArea();console.log(safeArea);// { top: 88, bottom: 34 }// top: 状态栏高度(物理像素)// bottom: 导航栏高度(物理像素)返回值:
| 参数 | 类型 | 说明 |
|---|---|---|
| top | number | 状态栏安全区域高度(物理像素) |
| bottom | number | 导航栏安全区域高度(物理像素) |
注意:此方法为同步方法,直接返回结果。安全区域信息由客户端通过 UserAgent 注入(
SafeAreaTop/xx SafeAreaBottom/xx),需要客户端调用setSafeArea或fitSystemWindows后才能获取到正确的值。