main.js 2.9 KB

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