main.js 2.2 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 { download } from '@/utils/request'
  13. import './assets/icons' // icon
  14. import './permission' // permission control
  15. import { getDicts } from "@/api/system/dict/data";
  16. import { getConfigKey } from "@/api/system/config";
  17. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree,levelText,getArea } from "@/utils/ruoyi";
  18. import Pagination from "@/components/Pagination";
  19. //自定义表格工具扩展
  20. import RightToolbar from "@/components/RightToolbar"
  21. // 全局方法挂载
  22. Vue.prototype.getDicts = getDicts
  23. Vue.prototype.getConfigKey = getConfigKey
  24. Vue.prototype.parseTime = parseTime
  25. Vue.prototype.resetForm = resetForm
  26. Vue.prototype.addDateRange = addDateRange
  27. Vue.prototype.selectDictLabel = selectDictLabel
  28. Vue.prototype.selectDictLabels = selectDictLabels
  29. Vue.prototype.download = download
  30. Vue.prototype.handleTree = handleTree
  31. Vue.prototype.levelText = levelText
  32. Vue.prototype.getArea = getArea
  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('Pagination', Pagination)
  44. Vue.component('RightToolbar', RightToolbar)
  45. Vue.use(permission)
  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. })