main.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import { createApp } from 'vue'
  2. import Cookies from 'js-cookie'
  3. import ElementPlus from 'element-plus'
  4. import locale from 'element-plus/lib/locale/lang/zh-cn' // 中文语言
  5. import '@/assets/styles/index.scss' // global css
  6. import App from './App'
  7. import store from './store'//pinia
  8. import router from './router'
  9. import directive from './directive' // directive
  10. import CKEditor from '@ckeditor/ckeditor5-vue';
  11. // 注册指令
  12. import plugins from './plugins' // plugins
  13. import { download } from '@/utils/request'
  14. //引入字体
  15. import '@/assets/fonts/font.css'
  16. // import VueDND from 'awe-dnd'
  17. // svg图标
  18. import 'virtual:svg-icons-register'
  19. import SvgIcon from '@/components/SvgIcon'
  20. import elementIcons from '@/components/SvgIcon/svgicon'
  21. import * as ElementPlusIconsVue from '@element-plus/icons-vue'
  22. import './permission' // permission control
  23. import { useDict } from '@/utils/dict'
  24. import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
  25. // 分页组件
  26. import Pagination from '@/components/Pagination'
  27. // 自定义表格工具组件
  28. import RightToolbar from '@/components/RightToolbar'
  29. // 富文本组件
  30. import Editor from "@/components/Editor"
  31. // 文件上传组件
  32. import FileUpload from "@/components/FileUpload"
  33. // 图片上传组件
  34. import ImageUpload from "@/components/ImageUpload"
  35. // 图片预览组件
  36. import ImagePreview from "@/components/ImagePreview"
  37. // 自定义树选择组件
  38. import TreeSelect from '@/components/TreeSelect'
  39. // 字典标签组件
  40. import DictTag from '@/components/DictTag'
  41. const app = createApp(App).use( CKEditor )
  42. // for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  43. // app.component(key, component)
  44. // }
  45. // 全局方法挂载
  46. app.config.globalProperties.useDict = useDict
  47. app.config.globalProperties.download = download
  48. app.config.globalProperties.parseTime = parseTime
  49. app.config.globalProperties.resetForm = resetForm
  50. app.config.globalProperties.handleTree = handleTree
  51. app.config.globalProperties.addDateRange = addDateRange
  52. app.config.globalProperties.selectDictLabel = selectDictLabel
  53. app.config.globalProperties.selectDictLabels = selectDictLabels
  54. // 全局组件挂载
  55. app.component('DictTag', DictTag)
  56. app.component('Pagination', Pagination)
  57. app.component('TreeSelect', TreeSelect)
  58. app.component('FileUpload', FileUpload)
  59. app.component('ImageUpload', ImageUpload)
  60. app.component('ImagePreview', ImagePreview)
  61. app.component('RightToolbar', RightToolbar)
  62. app.component('Editor', Editor)
  63. app.use(router)
  64. app.use(store)
  65. // app.use(VueDND)
  66. app.use(plugins)
  67. app.use(elementIcons)
  68. app.component('svg-icon', SvgIcon)
  69. directive(app)
  70. // 使用element-plus 并且设置全局的大小
  71. app.use(ElementPlus, {
  72. locale: locale,
  73. // 支持 large、default、small
  74. size: Cookies.get('size') || 'default'
  75. })
  76. app.mount('#app')