main.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { createApp } from 'vue'
  2. import App from './App.vue'
  3. import router from './router'
  4. import { loadLang } from '/@/lang/index'
  5. import { registerIcons } from '/@/utils/common'
  6. import ElementPlus from 'element-plus'
  7. import mitt from 'mitt'
  8. import pinia from '/@/stores/index'
  9. import { directives } from '/@/utils/directives'
  10. import 'element-plus/dist/index.css'
  11. import 'element-plus/theme-chalk/display.css'
  12. import '/@/styles/index.scss'
  13. import * as ElementPlusIconsVue from '@element-plus/icons-vue'
  14. // modules import mark, Please do not remove.
  15. async function start() {
  16. const app = createApp(App)
  17. // 全局注册element-plus的icon
  18. for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  19. app.component(key, component)
  20. }
  21. app.use(pinia)
  22. // 全局语言包加载
  23. await loadLang(app)
  24. app.use(router)
  25. app.use(ElementPlus)
  26. // 全局注册
  27. directives(app) // 指令
  28. registerIcons(app) // icons
  29. app.mount('#app')
  30. // modules start mark, Please do not remove.
  31. app.config.globalProperties.eventBus = mitt()
  32. }
  33. start()