main.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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/common.scss' // common css
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import permission from './directive/permission'
  12. import VueClipboard from 'vue-clipboard2'
  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 { getAge,parsePhoto,formatDate,parsePost,parseArr,formatMoney,parseTime,dateFormat, resetForm, addDateRange, selectDictLabel, selectDictLabels, download, handleTree } from "@/utils/common";
  18. import Pagination from "@/components/Pagination";
  19. //自定义表格工具扩展
  20. import RightToolbar from "@/components/RightToolbar"
  21. import FormMaking from 'form-making'
  22. import 'form-making/dist/FormMaking.css'
  23. Vue.use(VueClipboard)
  24. Vue.use(FormMaking)
  25. // 全局方法挂载
  26. Vue.prototype.getDicts = getDicts
  27. Vue.prototype.getConfigKey = getConfigKey
  28. Vue.prototype.parseTime = parseTime
  29. Vue.prototype.transformDateFormat = dateFormat
  30. Vue.prototype.resetForm = resetForm
  31. Vue.prototype.addDateRange = addDateRange
  32. Vue.prototype.selectDictLabel = selectDictLabel
  33. Vue.prototype.selectDictLabels = selectDictLabels
  34. Vue.prototype.download = download
  35. Vue.prototype.handleTree = handleTree
  36. Vue.prototype.formatMoney = formatMoney
  37. Vue.prototype.parseArr = parseArr
  38. Vue.prototype.parsePost = parsePost
  39. Vue.prototype.formatDate = formatDate
  40. Vue.prototype.parsePhoto = parsePhoto
  41. Vue.prototype.getAge = getAge
  42. Vue.prototype.msgSuccess = function (msg) {
  43. this.$message({ showClose: true, message: msg, type: "success" });
  44. }
  45. Vue.prototype.msgError = function (msg) {
  46. this.$message({ showClose: true, message: msg, type: "error" });
  47. }
  48. Vue.prototype.msgInfo = function (msg) {
  49. this.$message.info(msg);
  50. }
  51. // 全局组件挂载
  52. Vue.component('Pagination', Pagination)
  53. Vue.component('RightToolbar', RightToolbar)
  54. Vue.use(permission)
  55. /**
  56. * If you don't want to use mock-server
  57. * you want to use MockJs for mock api
  58. * you can execute: mockXHR()
  59. *
  60. * Currently MockJs will be used in the production environment,
  61. * please remove it before going online! ! !
  62. */
  63. Vue.use(Element, {
  64. size: Cookies.get('size') || 'medium' // set element-ui default size
  65. })
  66. Vue.config.productionTip = false
  67. new Vue({
  68. el: '#app',
  69. router,
  70. store,
  71. render: h => h(App)
  72. })