main.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import Element from 'element-ui'
  4. import './assets/fonts/iconfont.css'
  5. import './assets/styles/element-variables.scss'
  6. import '@/assets/styles/index.scss' // global css
  7. import '@/assets/styles/ruoyi.scss' // ruoyi css
  8. import App from './App'
  9. import store from './store'
  10. import api from '@/api/api'
  11. import upload from '@/utils/uploadFile'
  12. import router from './router'
  13. import directive from './directive' //directive
  14. import plugins from './plugins' // plugins
  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/ruoyi";
  20. // 分页组件
  21. import Pagination from "@/components/Paginations";
  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 DictTag from '@/components/DictTag'
  32. // 头部标签组件
  33. import VueMeta from 'vue-meta'
  34. // 字典数据组件
  35. import DictData from '@/components/DictData'
  36. import methodsTools from '@/utils/methodsTool'
  37. // 全局方法挂载
  38. Vue.prototype.$store = store
  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.handleTree = handleTree
  47. Vue.prototype.$api = api
  48. Vue.prototype.$upload = upload
  49. Vue.prototype.$methodsTools = methodsTools
  50. // 全局组件挂载
  51. Vue.component('DictTag', DictTag)
  52. Vue.component('Pagination', Pagination)
  53. Vue.component('RightToolbar', RightToolbar)
  54. Vue.component('Editor', Editor)
  55. Vue.component('FileUpload', FileUpload)
  56. Vue.component('ImageUpload', ImageUpload)
  57. Vue.use(directive)
  58. Vue.use(plugins)
  59. Vue.use(VueMeta)
  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. })