main.js 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import Element from 'element-ui'
  4. import AFTableColumn from 'af-table-column'
  5. import './assets/fonts/iconfont.css'
  6. import './assets/styles/element-variables.scss'
  7. import '@/assets/styles/index.scss' // global css
  8. import '@/assets/styles/ruoyi.scss' // ruoyi css
  9. import App from './App'
  10. import store from './store'
  11. import api from '@/api/api'
  12. import gsap from 'gsap'
  13. import upload from '@/utils/uploadFile'
  14. import router from './router'
  15. import directive from './directive' //directive
  16. import plugins from './plugins' // plugins
  17. import './assets/icons' // icon
  18. import './permission' // permission control
  19. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  20. // 通用弹窗
  21. import BaseDialog from "@/components/BaseDialog";
  22. // 分页组件
  23. import Pagination from "@/components/Paginations";
  24. // 自定义表格工具组件
  25. import RightToolbar from "@/components/RightToolbar"
  26. // 文件上传组件
  27. import FileUpload from "@/components/FileUpload"
  28. // 字典标签组件
  29. import DictTag from '@/components/DictTag'
  30. import methodsTools from '@/utils/methodsTool'
  31. // 全局方法挂载
  32. Vue.prototype.$store = store
  33. Vue.prototype.parseTime = parseTime
  34. Vue.prototype.resetForm = resetForm
  35. Vue.prototype.addDateRange = addDateRange
  36. Vue.prototype.selectDictLabel = selectDictLabel
  37. Vue.prototype.selectDictLabels = selectDictLabels
  38. Vue.prototype.handleTree = handleTree
  39. Vue.prototype.$api = api
  40. Vue.prototype.$upload = upload
  41. Vue.prototype.$methodsTools = methodsTools
  42. Vue.prototype.gsap = gsap
  43. // 全局组件挂载
  44. Vue.component('DictTag', DictTag)
  45. Vue.component('Pagination', Pagination)
  46. Vue.component('BaseDialog', BaseDialog)
  47. Vue.component('RightToolbar', RightToolbar)
  48. Vue.component('FileUpload', FileUpload)
  49. const fontRate = {
  50. CHAR_RATE: 1.1, // 汉字比率
  51. NUM_RATE: 0.65, // 数字
  52. OTHER_RATE: 0.8 // 除汉字和数字以外的字符的比率
  53. }
  54. const fontSize = 16
  55. // 注册组件
  56. Vue.use(AFTableColumn, { fontRate, fontSize })
  57. Vue.use(directive)
  58. Vue.use(plugins)
  59. /**
  60. * If you don't want to use mock-server
  61. * you want to use MockJs for mock api
  62. * you can execute: mockXHR()
  63. *
  64. * Currently MockJs will be used in the production environment,
  65. * please remove it before going online! ! !
  66. */
  67. Vue.use(Element, {
  68. size: Cookies.get('size') || 'medium' // set element-ui default size
  69. })
  70. Vue.config.productionTip = false
  71. new Vue({
  72. el: '#app',
  73. router,
  74. store,
  75. render: h => h(App)
  76. })