main.js 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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/font-awesome-4.7.0/css/font-awesome.min.css'
  6. import '@/assets/styles/index.scss' // global css
  7. import '@/assets/styles/ezhizao/list.css'
  8. import '@/assets/styles/ezhizao/form.css'
  9. import '@/assets/styles/ezhizao/dialog.css'
  10. import App from './App'
  11. import store from './store'
  12. import router from './router'
  13. import directive from './directive' // directive
  14. import regionHelper from './utils/regionHelper'
  15. // 注册指令
  16. import plugins from './plugins' // plugins
  17. import { download } from '@/utils/request'
  18. // svg图标
  19. import 'virtual:svg-icons-register'
  20. import SvgIcon from '@/components/SvgIcon'
  21. import elementIcons from '@/components/SvgIcon/svgicon'
  22. import './permission' // permission control
  23. import { useDict } from '@/utils/dict'
  24. import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi'
  25. import { deepClone } from '@/utils/index'
  26. import moment from 'moment'
  27. // 分页组件
  28. import Pagination from '@/components/Pagination'
  29. // 自定义表格工具组件
  30. import RightToolbar from '@/components/RightToolbar'
  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. // 富文本编辑器
  42. import Editor from './components/Editor'
  43. // vueCountTo
  44. import CountTo from './components/VueCountTo'
  45. const app = createApp(App)
  46. // 全局方法挂载
  47. app.config.globalProperties.useDict = useDict
  48. app.config.globalProperties.download = download
  49. app.config.globalProperties.parseTime = parseTime
  50. app.config.globalProperties.resetForm = resetForm
  51. app.config.globalProperties.handleTree = handleTree
  52. app.config.globalProperties.addDateRange = addDateRange
  53. app.config.globalProperties.selectDictLabel = selectDictLabel
  54. app.config.globalProperties.selectDictLabels = selectDictLabels
  55. app.config.globalProperties.deepClone = deepClone
  56. app.config.globalProperties.region = regionHelper
  57. app.config.globalProperties.moment = moment
  58. // 全局组件挂载stor
  59. app.component('DictTag', DictTag)
  60. app.component('Pagination', Pagination)
  61. app.component('TreeSelect', TreeSelect)
  62. app.component('FileUpload', FileUpload)
  63. app.component('ImageUpload', ImageUpload)
  64. app.component('ImagePreview', ImagePreview)
  65. app.component('RightToolbar', RightToolbar)
  66. app.component('Editor', Editor)
  67. app.component('CountTo', CountTo)
  68. app.use(router)
  69. app.use(store)
  70. app.use(plugins)
  71. app.use(elementIcons)
  72. app.component('svg-icon', SvgIcon)
  73. directive(app)
  74. // 使用element-plus 并且设置全局的大小
  75. app.use(ElementPlus, {
  76. locale: locale,
  77. // 支持 large、default、small
  78. size: Cookies.get('size') || 'default'
  79. })
  80. app.mount('#app')