// data中 设置全局变量

// app.js

taroGlobalData = {
    navHeight: '',
    navTop:''
  }
  componentDidMount () {
    let menuButtonObject = wx.getMenuButtonBoundingClientRect();
    wx.getSystemInfo({
      success: res => {
        let statusBarHeight = res.statusBarHeight,
        navTop = menuButtonObject.top,//胶囊按钮与顶部的距离
        navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight)*2;//导航高度
        this.taroGlobalData.navHeight = navHeight;
        this.taroGlobalData.navTop = navTop;
      },
      fail(err) {
        console.log(err);
      }
    })
  }


// 在页面使用
// 实例化
const app = Taro.getApp()
// 使用app.调用