App.vue 1.5 KB

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