app.js 884 B

12345678910111213141516171819202122232425262728
  1. // app.js
  2. App({
  3. onLaunch() {
  4. /* 计算tabbar+iphone安全距离 tabbar页面+100rpx*/
  5. let safeAreaBottom = 0,
  6. capsule = wx.getMenuButtonBoundingClientRect(),
  7. height = 200,
  8. that = this;
  9. wx.getSystemInfo({
  10. success(res) {
  11. //计算底部安全距离高度
  12. // safeAreaBottom += res.screenHeight - res.safeArea.height;
  13. //计算自定义导航的高度
  14. height = capsule.height + res.statusBarHeight + (capsule.top - res.statusBarHeight) + 8;
  15. that.globalData.safeAreaBottom = safeAreaBottom;
  16. //判断是否为平板
  17. if (res.model.slice(0, 4) == "iPad") return that.globalData.myNavBorHeight = height;
  18. that.globalData.myNavBorHeight = height * 2;
  19. }
  20. })
  21. },
  22. globalData: {
  23. myNavBorHeight: null, //自定义头部导航高度
  24. account_list: [], //用户列表
  25. }
  26. })