import { createSSRApp } from "vue";
import App from "./App.vue";
import * as Pinia from "pinia";
import shareMixin from "./mixin/shareMixin.js";

// 全局请求
import http from "./utils/request.js";
// 精度计算
import decimal from "./utils/decimal.js";
// 权限检查
import checkAccess from "./utils/checkaccess.js";
// 获取ext配置
import ext from "./utils/ext.js";

export function createApp() {
  const app = createSSRApp(App);
  app.mixin(shareMixin);
  app.use(Pinia.createPinia());
  // 挂载全局属性
  app.config.globalProperties.$http = http;
  // 挂载全局属性
  app.config.globalProperties.$decimal = decimal;
  // 挂载全局属性
  app.config.globalProperties.$checkAccess = checkAccess;
  app.config.globalProperties.$ext = ext;
  return {
    app,
    Pinia,
  };
}
