main.js 2.2 KB

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