main.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // 引入unocss css
  2. import '@/plugins/unocss'
  3. // 导入全局的svg图标
  4. import '@/plugins/svgIcon'
  5. // 初始化多语言
  6. import { setupI18n } from '@/plugins/vueI18n'
  7. // 引入状态管理
  8. import { setupStore } from '@/store'
  9. // 全局组件
  10. import { setupGlobCom } from '@/components'
  11. // 引入 element-plus
  12. import { setupElementPlus } from '@/plugins/elementPlus'
  13. // 引入 form-create
  14. import { setupFormCreate } from '@/plugins/formCreate'
  15. // 引入全局样式
  16. import '@/styles/index.scss'
  17. // 引入动画
  18. import '@/plugins/animate.css'
  19. // 路由
  20. import router, { setupRouter } from '@/router'
  21. // 权限
  22. import { setupAuth } from '@/directives'
  23. import { createApp } from 'vue'
  24. import App from './App.vue'
  25. import './permission'
  26. import '@/plugins/tongji' // 百度统计
  27. import Logger from '@/utils/Logger'
  28. import VueDOMPurifyHTML from 'vue-dompurify-html' // 解决v-html 的安全隐患
  29. // 创建实例
  30. const setupAll = async () => {
  31. const app = createApp(App)
  32. await setupI18n(app)
  33. setupStore(app)
  34. setupGlobCom(app)
  35. setupElementPlus(app)
  36. setupFormCreate(app)
  37. setupRouter(app)
  38. setupAuth(app)
  39. await router.isReady()
  40. app.use(VueDOMPurifyHTML)
  41. app.mount('#app')
  42. }
  43. setupAll()
  44. Logger.prettyPrimary(`欢迎使用`, import.meta.env.VITE_APP_TITLE)