main.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 CascaderComponent from '@/components/CascaderComponent';
  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 router from './router'
  11. import directive from './directive' // directive
  12. import plugins from './plugins' // plugins
  13. import { download } from '@/utils/request'
  14. import './assets/icons' // icon
  15. import './permission' // permission control
  16. import { getDicts } from "@/api/system/dict/data";
  17. import { getConfigKey } from "@/api/system/config";
  18. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi";
  19. // 分页组件
  20. import Pagination from "@/components/Pagination";
  21. // 自定义表格工具组件
  22. import RightToolbar from "@/components/RightToolbar"
  23. // 富文本组件
  24. import Editor from "@/components/Editor"
  25. // 文件上传组件
  26. import FileUpload from "@/components/FileUpload"
  27. // 图片上传组件
  28. import ImageUpload from "@/components/ImageUpload"
  29. // 图片预览组件
  30. import ImagePreview from "@/components/ImagePreview"
  31. // 字典标签组件
  32. import DictTag from '@/components/DictTag'
  33. // 头部标签组件
  34. import VueMeta from 'vue-meta'
  35. // 字典数据组件
  36. import DictData from '@/components/DictData'
  37. // 全局方法挂载
  38. Vue.prototype.getDicts = getDicts
  39. Vue.prototype.getConfigKey = getConfigKey
  40. Vue.prototype.parseTime = parseTime
  41. Vue.prototype.resetForm = resetForm
  42. Vue.prototype.addDateRange = addDateRange
  43. Vue.prototype.selectDictLabel = selectDictLabel
  44. Vue.prototype.selectDictLabels = selectDictLabels
  45. Vue.prototype.download = download
  46. Vue.prototype.handleTree = handleTree
  47. // 全局组件挂载
  48. Vue.component('DictTag', DictTag)
  49. Vue.component('Pagination', Pagination)
  50. Vue.component('RightToolbar', RightToolbar)
  51. Vue.component('Editor', Editor)
  52. Vue.component('FileUpload', FileUpload)
  53. Vue.component('ImageUpload', ImageUpload)
  54. Vue.component('ImagePreview', ImagePreview)
  55. Vue.component('cascader-component', CascaderComponent);
  56. Vue.use(directive)
  57. Vue.use(plugins)
  58. Vue.use(VueMeta)
  59. DictData.install()
  60. import "@/assets/styles/ruoyi.scss"
  61. // window.onresize =function (){// 绑定到窗口缩放的事件
  62. // init();
  63. // };
  64. // //页面刚刷新时调用
  65. // init()
  66. // function init() {
  67. // var whdef = 50 / 1920;
  68. // var wH = window.innerHeight;// 当前窗口的高度
  69. // var wW = window.innerWidth;// 当前窗口的宽度
  70. // var rem = wW * whdef / 2;// 以默认比例值乘以当前窗口宽度,得到该宽度下的相应FONT-SIZE值
  71. // // $('html').css('font-size', rem + "px");
  72. // document.documentElement.style.fontSize =rem + "px";
  73. // console.log(rem);
  74. // }
  75. /**
  76. * If you don't want to use mock-server
  77. * you want to use MockJs for mock api
  78. * you can execute: mockXHR()
  79. *
  80. * Currently MockJs will be used in the production environment,
  81. * please remove it before going online! ! !
  82. */
  83. Vue.use(Element, {
  84. size: Cookies.get('size') || 'medium' // set element-ui default size
  85. })
  86. Vue.config.productionTip = false
  87. new Vue({
  88. el: '#app',
  89. router,
  90. store,
  91. render: h => h(App)
  92. })