main.js 3.1 KB

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