import { createApp } from 'vue';
import App from './App.vue';

import { setupStore } from '@/stores/index';
import router, { setupRouter } from '@/router/index';
import { setupElementPlus } from '@/plugins/element-plus';
import { setupDirectives } from '@/plugins/directives';
import { setupVxeTabele } from './plugins/vxe-table';
import ProTable from '@/components/ProTable/index.vue';
import Tag from '@/components/Tag/index.vue';
import { download } from '@/utils/http/index';
export async function bootstrapInstall() {
  const app = createApp(App);

  // 挂载状态管理
  setupStore(app);

  // 注册全局自定义指令，如：v-permission权限指令
  setupDirectives(app);

  // 挂载element ui 组件
  setupElementPlus(app);

  // 挂载 vxe-table 表格
  setupVxeTabele(app);

  // 挂载路由
  setupRouter(app);
  app.component('ProTable', ProTable);
  app.component('Tag', Tag);
  app.provide('download', download);
  // 路由准备就绪后挂载 APP 实例
  await router.isReady();

  app.mount('#app');
}
