main.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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/common.scss'
  7. import App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import directive from './directive' //directive
  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 {cloneObject, parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/common";
  16. import Pagination from "@/components/Pagination";
  17. // 自定义表格工具组件
  18. import RightToolbar from "@/components/RightToolbar"
  19. // 富文本组件
  20. import Editor from "@/components/Editor"
  21. // 文件上传组件
  22. import FileUpload from "@/components/FileUpload"
  23. // 图片上传组件
  24. import ImageUpload from "@/components/ImageUpload"
  25. // 字典标签组件
  26. import DictTag from '@/components/DictTag'
  27. // 头部标签组件
  28. import VueMeta from 'vue-meta'
  29. import * as echarts from "echarts";
  30. // 全局方法挂载
  31. import { VueJsonp } from 'vue-jsonp'
  32. Vue.use(VueJsonp)
  33. // 全局配置
  34. Vue.prototype.logImg = require(process.env.VUE_APP_LOG_URL)
  35. Vue.prototype.cloneObject = cloneObject
  36. Vue.prototype.getDicts = getDicts
  37. Vue.prototype.getConfigKey = getConfigKey
  38. Vue.prototype.parseTime = parseTime
  39. Vue.prototype.resetForm = resetForm
  40. Vue.prototype.addDateRange = addDateRange
  41. Vue.prototype.selectDictLabel = selectDictLabel
  42. Vue.prototype.selectDictLabels = selectDictLabels
  43. Vue.prototype.download = download
  44. Vue.prototype.handleTree = handleTree
  45. Vue.prototype.echarts = echarts
  46. Vue.prototype.msgSuccess = function (msg) {
  47. this.$message({ showClose: true, message: msg, type: "success" });
  48. }
  49. Vue.prototype.msgError = function (msg) {
  50. this.$message({ showClose: true, message: msg, type: "error" });
  51. }
  52. Vue.prototype.msgInfo = function (msg) {
  53. this.$message.info(msg);
  54. }
  55. // 全局组件挂载
  56. Vue.component('DictTag', DictTag)
  57. Vue.component('Pagination', Pagination)
  58. Vue.component('RightToolbar', RightToolbar)
  59. Vue.component('Editor', Editor)
  60. Vue.component('FileUpload', FileUpload)
  61. Vue.component('ImageUpload', ImageUpload)
  62. import H5Editor from "@/components/H5Editor";
  63. Vue.component('H5Editor', H5Editor)
  64. Vue.use(directive)
  65. Vue.use(VueMeta)
  66. /**
  67. * If you don't want to use mock-server
  68. * you want to use MockJs for mock api
  69. * you can execute: mockXHR()
  70. *
  71. * Currently MockJs will be used in the production environment,
  72. * please remove it before going online! ! !
  73. */
  74. Vue.use(Element, {
  75. size: Cookies.get('size') || 'medium' // set element-ui default size
  76. })
  77. Vue.config.productionTip = false
  78. new Vue({
  79. el: '#app',
  80. router,
  81. store,
  82. render: h => h(App)
  83. })