main.js 3.2 KB

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