main.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import Vue from 'vue'
  2. import Cookies from 'js-cookie'
  3. import 'normalize.css/normalize.css' // a modern alternative to CSS resets
  4. import Element from 'element-ui'
  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 router from './router'
  11. import permission from './directive/permission'
  12. import './assets/icons' // icon
  13. import './permission' // permission control
  14. import { getDicts } from "@/api/system/dict/data";
  15. import { getConfigKey } from "@/api/system/config";
  16. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/ruoyi";
  17. import Pagination from "@/components/Pagination";
  18. //自定义表格工具扩展
  19. import RightToolbar from "@/components/RightToolbar"
  20. import echarts from "echarts";
  21. // 全局方法挂载
  22. Vue.prototype.$echarts = echarts;
  23. Vue.prototype.getDicts = getDicts
  24. Vue.prototype.getConfigKey = getConfigKey
  25. Vue.prototype.parseTime = parseTime
  26. Vue.prototype.resetForm = resetForm
  27. Vue.prototype.addDateRange = addDateRange
  28. Vue.prototype.selectDictLabel = selectDictLabel
  29. Vue.prototype.selectDictLabels = selectDictLabels
  30. Vue.prototype.download = download
  31. Vue.prototype.handleTree = handleTree
  32. Vue.prototype.msgSuccess = function (msg) {
  33. this.$message({ showClose: true, message: msg, type: "success" });
  34. }
  35. Vue.prototype.msgError = function (msg) {
  36. this.$message({ showClose: true, message: msg, type: "error" });
  37. }
  38. Vue.prototype.msgInfo = function (msg) {
  39. this.$message.info(msg);
  40. }
  41. // 全局组件挂载
  42. Vue.component('Pagination', Pagination)
  43. Vue.component('RightToolbar', RightToolbar)
  44. Vue.use(permission)
  45. /**
  46. * If you don't want to use mock-server
  47. * you want to use MockJs for mock api
  48. * you can execute: mockXHR()
  49. *
  50. * Currently MockJs will be used in the production environment,
  51. * please remove it before going online! ! !
  52. */
  53. Vue.use(Element, {
  54. size: Cookies.get('size') || 'medium' // set element-ui default size
  55. })
  56. Vue.config.productionTip = false
  57. new Vue({
  58. el: '#app',
  59. router,
  60. store,
  61. render: h => h(App)
  62. })