app.ts 720 B

12345678910111213141516171819202122232425262728
  1. import './utils/system/index'
  2. import './services/index' // 初始化服务
  3. App({
  4. globalData: {
  5. /// iPhone底部安全区域
  6. safeBottom: 0.0,
  7. /// 窗口高度
  8. windowHeight: 0,
  9. /// 导航栏高度
  10. navHeight: 0,
  11. /// 状态栏高度
  12. statusBarHeight: 0
  13. },
  14. onLaunch() {
  15. /// 获取iPhone底部安全区域
  16. wx.getSystemInfo({
  17. success: res => {
  18. this.globalData.safeBottom = res.screenHeight-res.safeArea.bottom
  19. this.globalData.windowHeight = res.windowHeight
  20. this.globalData.navHeight = res.screenHeight - res.windowHeight - res.statusBarHeight
  21. this.globalData.statusBarHeight = res.statusBarHeight
  22. },
  23. fail: () => {}
  24. })
  25. },
  26. })