import {createSSRApp} from "vue";
import App from "./App.vue";
import store from "./store";

export function createApp() {
  const app = createSSRApp(App);
  app.use(store)
  uni.getSystemInfo({
    success: function(e) {
      // #ifndef MP
      app.config.globalProperties.statusBar = e.statusBarHeight;
      if (e.platform == 'android') {
        // @ts-ignore
        app.config.globalProperties.customBar = e.statusBarHeight + 50;
      } else {
        // @ts-ignore
        app.config.globalProperties.customBar = e.statusBarHeight + 45;
      };
      // #endif

      // #ifdef MP-WEIXIN
      app.config.globalProperties.statusBar = e.statusBarHeight;
      // @ts-ignore
      let custom = wx.getMenuButtonBoundingClientRect();
      // @ts-ignore
      app.config.globalProperties.customBar = custom.bottom + custom.top - e.statusBarHeight;
      // #endif

      // #ifdef MP-ALIPAY
      app.config.globalProperties.statusBar = e.statusBarHeight;
      // @ts-ignore
      app.config.globalProperties.customBar = e.statusBarHeight + e.titleBarHeight;
      // #endif
    }
  })
  return {
    app,
  };
}
