main.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 hljs from 'highlight.js'
  21. import 'highlight.js/styles/github-gist.css'
  22. // 全局方法挂载
  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. Vue.use(hljs.vuePlugin);
  46. /**
  47. * If you don't want to use mock-server
  48. * you want to use MockJs for mock api
  49. * you can execute: mockXHR()
  50. *
  51. * Currently MockJs will be used in the production environment,
  52. * please remove it before going online! ! !
  53. */
  54. Vue.use(Element, {
  55. size: Cookies.get('size') || 'medium' // set element-ui default size
  56. })
  57. Vue.config.productionTip = false
  58. new Vue({
  59. el: '#app',
  60. router,
  61. store,
  62. render: h => h(App)
  63. })