main.js 2.3 KB

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