main.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import Element from 'element-ui'
  4. import './assets/styles/element-variables.scss'
  5. import VueCodemirror from 'vue-codemirror'
  6. import 'codemirror/lib/codemirror.css'
  7. import '@/assets/styles/index.scss' // global css
  8. import '@/assets/styles/common.scss' //
  9. import App from './App'
  10. import store from './store'
  11. import router from './router'
  12. import directive from './directive' // directive
  13. import plugins from './plugins' // plugins
  14. import { download } from '@/utils/request'
  15. import './assets/icons' // icon
  16. import './permission' // permission control
  17. import { getDicts } from "@/api/system/dict/data";
  18. import { getConfigKey } from "@/api/system/config";
  19. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/common";
  20. // 分页组件
  21. import Pagination from "@/components/Pagination";
  22. // 自定义表格工具组件
  23. import RightToolbar from "@/components/RightToolbar"
  24. // 富文本组件
  25. import Editor from "@/components/Editor"
  26. // 文件上传组件
  27. import FileUpload from "@/components/FileUpload"
  28. // 图片上传组件
  29. import ImageUpload from "@/components/ImageUpload"
  30. // 图片预览组件
  31. import ImagePreview from "@/components/ImagePreview"
  32. // 字典标签组件
  33. import DictTag from '@/components/DictTag'
  34. // 头部标签组件
  35. import VueMeta from 'vue-meta'
  36. // 字典数据组件
  37. import DictData from '@/components/DictData'
  38. // 全局方法挂载
  39. Vue.prototype.getDicts = getDicts
  40. Vue.prototype.getConfigKey = getConfigKey
  41. Vue.prototype.parseTime = parseTime
  42. Vue.prototype.resetForm = resetForm
  43. Vue.prototype.addDateRange = addDateRange
  44. Vue.prototype.selectDictLabel = selectDictLabel
  45. Vue.prototype.selectDictLabels = selectDictLabels
  46. Vue.prototype.download = download
  47. Vue.prototype.handleTree = handleTree
  48. // 全局组件挂载
  49. Vue.component('DictTag', DictTag)
  50. Vue.component('Pagination', Pagination)
  51. Vue.component('RightToolbar', RightToolbar)
  52. Vue.component('Editor', Editor)
  53. Vue.component('FileUpload', FileUpload)
  54. Vue.component('ImageUpload', ImageUpload)
  55. Vue.component('ImagePreview', ImagePreview)
  56. Vue.use(directive)
  57. Vue.use(plugins)
  58. Vue.use(VueMeta)
  59. Vue.use(VueCodemirror)
  60. DictData.install()
  61. /**
  62. * If you don't want to use mock-server
  63. * you want to use MockJs for mock api
  64. * you can execute: mockXHR()
  65. *
  66. * Currently MockJs will be used in the production environment,
  67. * please remove it before going online! ! !
  68. */
  69. Vue.use(Element, {
  70. size: Cookies.get('size') || 'medium' // set element-ui default size
  71. })
  72. Vue.config.productionTip = false
  73. new Vue({
  74. el: '#app',
  75. router,
  76. store,
  77. render: h => h(App)
  78. })