main.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import {createSSRApp} from "vue";
  2. import App from "./App.vue";
  3. import store from "./store";
  4. export function createApp() {
  5. const app = createSSRApp(App);
  6. app.use(store)
  7. uni.getSystemInfo({
  8. success: function(e) {
  9. // #ifndef MP
  10. app.config.globalProperties.statusBar = e.statusBarHeight;
  11. if (e.platform == 'android') {
  12. // @ts-ignore
  13. app.config.globalProperties.customBar = e.statusBarHeight + 50;
  14. } else {
  15. // @ts-ignore
  16. app.config.globalProperties.customBar = e.statusBarHeight + 45;
  17. };
  18. // #endif
  19. // #ifdef MP-WEIXIN
  20. app.config.globalProperties.statusBar = e.statusBarHeight;
  21. // @ts-ignore
  22. let custom = wx.getMenuButtonBoundingClientRect();
  23. // @ts-ignore
  24. app.config.globalProperties.customBar = custom.bottom + custom.top - e.statusBarHeight;
  25. // #endif
  26. // #ifdef MP-ALIPAY
  27. app.config.globalProperties.statusBar = e.statusBarHeight;
  28. // @ts-ignore
  29. app.config.globalProperties.customBar = e.statusBarHeight + e.titleBarHeight;
  30. // #endif
  31. }
  32. })
  33. return {
  34. app,
  35. };
  36. }