实现小程序iphonex与iphone6底部适配

实现iphonex与iphone6底部适配

  • 给底部要绝对定位的按钮或者组件添加
  height: 80px; // 底部组件高度
  position: fixed;
  left: 0;
  bottom: 0;
  right: 0;
  padding-bottom: calc(constant(safe-area-inset-bottom));
  padding-bottom: calc(env(safe-area-inset-bottom));
  • 给上边的内容区域添加
// +的是底部组件高度
padding-bottom: calc(constant(safe-area-inset-bottom) + 80px);
padding-bottom: calc(env(safe-area-inset-bottom) + 80px);
posted on 2020-11-28 13:42  Huskie!  阅读(330)  评论(0编辑  收藏  举报