main.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. import { createApp } from 'vue'
  2. import Cookies from 'js-cookie'
  3. import ElementPlus from 'element-plus'
  4. import 'element-plus/dist/index.css'
  5. import 'element-plus/theme-chalk/dark/css-vars.css'
  6. import locale from 'element-plus/es/locale/lang/zh-cn'
  7. import '@/assets/styles/index.scss' // global css
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import directive from './directive' // directive
  12. // 注册指令
  13. import plugins from './plugins' // plugins
  14. import { download } from '@/utils/request'
  15. // import * as RecorderManager from '@/utils/ai/iat/dist/index.d.ts'
  16. // svg图标
  17. import 'virtual:svg-icons-register'
  18. import SvgIcon from '@/components/SvgIcon'
  19. import elementIcons from '@/components/SvgIcon/svgicon'
  20. import './permission' // permission control
  21. import { useDict } from '@/utils/dict'
  22. import { getConfigKey } from "@/api/system/config"
  23. import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
  24. // 分页组件
  25. import Pagination from '@/components/Pagination'
  26. // 自定义表格工具组件
  27. import RightToolbar from '@/components/RightToolbar'
  28. // 富文本组件
  29. import Editor from "@/components/Editor"
  30. // 文件上传组件
  31. import FileUpload from "@/components/FileUpload"
  32. // 图片上传组件
  33. import ImageUpload from "@/components/ImageUpload"
  34. // 图片预览组件
  35. import ImagePreview from "@/components/ImagePreview"
  36. // 字典标签组件
  37. import DictTag from '@/components/DictTag'
  38. const app = createApp(App)
  39. // 全局方法挂载
  40. app.config.globalProperties.useDict = useDict
  41. app.config.globalProperties.download = download
  42. app.config.globalProperties.parseTime = parseTime
  43. app.config.globalProperties.resetForm = resetForm
  44. app.config.globalProperties.handleTree = handleTree
  45. app.config.globalProperties.addDateRange = addDateRange
  46. app.config.globalProperties.getConfigKey = getConfigKey
  47. app.config.globalProperties.selectDictLabel = selectDictLabel
  48. app.config.globalProperties.selectDictLabels = selectDictLabels
  49. // 全局组件挂载
  50. app.component('DictTag', DictTag)
  51. app.component('Pagination', Pagination)
  52. app.component('FileUpload', FileUpload)
  53. app.component('ImageUpload', ImageUpload)
  54. app.component('ImagePreview', ImagePreview)
  55. app.component('RightToolbar', RightToolbar)
  56. app.component('Editor', Editor)
  57. app.use(router)
  58. app.use(store)
  59. app.use(plugins)
  60. app.use(elementIcons)
  61. app.component('svg-icon', SvgIcon)
  62. directive(app)
  63. // 使用element-plus 并且设置全局的大小
  64. app.use(ElementPlus, {
  65. locale: locale,
  66. // 支持 large、default、small
  67. size: Cookies.get('size') || 'default'
  68. })
  69. app.mount('#app')