html52.com
我爱小程序-开发者交流社区

真机获取状态栏高度失效、延迟,昨天开发发现(2020年1月16日)

问题模块 框架类型 问题类型 API/组件名称 终端类型 微信版本 基础库版本
API和组件 小程序 Bug getSystemInfo 微信安卓客户端 7.0.10 2.10
wx.getSystemInfo({
  success: function (res) {
    that.globalData.statusBarHeight = res.statusBarHeight;
  },
  fail:function(res){
  }
})

有时候进入小程序能获取状态栏高度,页面正常,有时候进入不能获取状态栏高度

  

注:自定义标题栏

网友回复

社区技术运营专员-灵芝:

麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

铭锋科技:

获取不到再次获取一次

  setCustom() {
    let that = this
    wx.getSystemInfo({
      successe => {
        that.globalData.StatusBar = e.statusBarHeight
        let customA = wx.getMenuButtonBoundingClientRect()
        if (!customA.bottom) {
          that.globalData.CustomBar = e.platform == 'android' ? e.statusBarHeight + 50 : e.statusBarHeight + 45
          
        } else {
          let custom = customA
          that.globalData.Custom = custom
          that.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight

        }
        
      }
    })
  },

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付