App.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <script>
  2. import Vue from "vue";
  3. export default {
  4. onLaunch: function () {
  5. wx.getSystemInfo({
  6. success: (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.CustomBar =
  21. 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. fail(err) {
  32. console.log(err);
  33. },
  34. });
  35. },
  36. onShow: function () {
  37. console.log("App Show");
  38. // this.$audio.on("ended", "event-ended", (data) => {
  39. // setTimeout(() => {
  40. // this.$store.dispatch("changePlay", 1);
  41. // }, 300);
  42. // });
  43. },
  44. onHide: function () {
  45. console.log("App Hide");
  46. },
  47. methods: {},
  48. };
  49. </script>
  50. <style lang="scss">
  51. @import "@/common/App.scss";
  52. @import "@/common/icon.css";
  53. @import "@/colorui/main.css";
  54. @import "@/colorui/icon.css";
  55. </style>