import { createApp } from 'vue'
import naive from 'naive-ui'
import { setupNaive, setupDirectives } from '@/plugins'
import { directive } from '@/utils/directive'
import './style.css'
import App from './App.vue'
import router, { setupRouter } from './router'
import { setupStore } from '@/store'
import VueUeditorWrap from 'vue-ueditor-wrap'
async function bootstrap() {
  const app = createApp(App)

  // 注册全民指令
  directive(app)

  // 注册全局常用的 naive-ui 组件
  setupNaive(app)

  // 注册全局自定义组件
  //setupCustomComponents();

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

  // 注册全局方法，如：app.config.globalProperties.$message = message
  // setupGlobalMethods(app)

  // 挂载状态管理
  setupStore(app)
  app.use(VueUeditorWrap)

  // 挂载路由
  await setupRouter(app)

  // 路由准备就绪后挂载APP实例
  await router.isReady()

  app.mount('#app', true)
}

void bootstrap()
