App.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <script>
  2. import Vue from 'vue'
  3. export default {
  4. onLaunch: function() {
  5. uni.getSystemInfo({
  6. success: function(e) {
  7. // #ifndef MP
  8. Vue.prototype.StatusBar = e.statusBarHeight;
  9. if (e.platform == 'android') {
  10. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  11. } else {
  12. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  13. };
  14. // #endif
  15. // #ifdef MP-WEIXIN || MP-QQ
  16. Vue.prototype.StatusBar = e.statusBarHeight;
  17. let capsule = wx.getMenuButtonBoundingClientRect();
  18. if (capsule) {
  19. Vue.prototype.Custom = capsule;
  20. // Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
  21. Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
  22. } else {
  23. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  24. }
  25. // #endif
  26. // #ifdef MP-ALIPAY
  27. Vue.prototype.StatusBar = e.statusBarHeight;
  28. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  29. // #endif
  30. }
  31. })
  32. },
  33. onShow: function() {
  34. console.log('App Show')
  35. },
  36. onHide: function() {
  37. console.log('App Hide')
  38. }
  39. }
  40. </script>
  41. <style>
  42. @import "utils/css/main.css";
  43. @import "utils/css/icon.css";
  44. </style>