GDScript3
2 行
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
JavaScript
5 行
uni.getSysteminfo({
  success: res => {
    let safeArea = res.safeAreaInsets.bottom;
  }
})

该APi返回一个对象,包含 top right bottom left width height,其中bottom为安全区域高度

对应的兼容情况如下,uni-app的版本2.5.3+使用safeAreaInsets值

safeArea 在竖屏正方向下的安全区域 App、H5、微信小程序
safeAreaInsets 在竖屏正方向下的安全区域插入位置(2.5.3+) App、H5、微信小程序