App.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <script>
  2. import Vue from 'vue';
  3. export default {
  4. onLaunch: function() {
  5. // this.$store.dispatch('userInfo/getinfo');
  6. uni.getSystemInfo({
  7. success: function(e) {
  8. // #ifndef MP
  9. Vue.prototype.StatusBar = e.statusBarHeight;
  10. if (e.platform == 'android') {
  11. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  12. } else {
  13. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  14. };
  15. // #endif
  16. // #ifdef MP-WEIXIN || MP-QQ
  17. Vue.prototype.StatusBar = e.statusBarHeight;
  18. Vue.prototype.pxToRpx = 750 / e.windowWidth; //e.windowHeight会有差别顶部栏
  19. let capsule = wx.getMenuButtonBoundingClientRect();
  20. if (capsule) {
  21. Vue.prototype.Custom = capsule;
  22. // Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right;
  23. Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight;
  24. } else {
  25. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  26. }
  27. // #endif
  28. // #ifdef MP-ALIPAY
  29. Vue.prototype.StatusBar = e.statusBarHeight;
  30. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  31. // #endif
  32. }
  33. })
  34. },
  35. onShow: function() {
  36. console.log('App Show')
  37. },
  38. onHide: function() {
  39. console.log('App Hide')
  40. }
  41. }
  42. </script>
  43. <style lang='scss'>
  44. @import "style/common.css";
  45. @import "style/icon.css";
  46. .input-placeholder,
  47. .placeholder {
  48. color: $placeholder-color !important;
  49. }
  50. /*每个页面公共css */
  51. </style>