app.ts 755 B

12345678910111213141516171819202122232425262728293031
  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. console.log(res)
  19. this.globalData.safeBottom = res.screenHeight-res.safeArea.bottom
  20. this.globalData.windowHeight = res.windowHeight
  21. this.globalData.navHeight = res.screenHeight - res.windowHeight - res.statusBarHeight
  22. this.globalData.statusBarHeight = res.statusBarHeight
  23. },
  24. fail: () => {}
  25. })
  26. },
  27. })