main.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 './styles/element-variables.scss'
  6. import '@/styles/index.scss' // global css
  7. import '@/styles/admin.scss'
  8. import App from './App'
  9. import store from './store'
  10. import router from './router'
  11. import permission from './directive/permission'
  12. import { getDicts } from '@/api/admin/dict/data'
  13. import { getItems, setItems } from '@/api/table'
  14. import { getConfigKey } from '@/api/admin/sys-config'
  15. import { parseTime, resetForm, addDateRange, selectDictLabel, download, selectItemsLabel } from '@/utils/costum'
  16. import './icons' // icon
  17. import './permission' // permission control
  18. import './utils/error-log' // error log
  19. import Viser from 'viser-vue'
  20. Vue.use(Viser)
  21. import * as filters from './filters' // global filters
  22. import Pagination from '@/components/Pagination'
  23. import BasicLayout from '@/layout/BasicLayout'
  24. import VueParticles from 'vue-particles'
  25. Vue.use(VueParticles)
  26. import '@/utils/dialog'
  27. // 全局方法挂载
  28. Vue.prototype.getDicts = getDicts
  29. Vue.prototype.getItems = getItems
  30. Vue.prototype.setItems = setItems
  31. Vue.prototype.getConfigKey = getConfigKey
  32. Vue.prototype.parseTime = parseTime
  33. Vue.prototype.resetForm = resetForm
  34. Vue.prototype.addDateRange = addDateRange
  35. Vue.prototype.selectDictLabel = selectDictLabel
  36. Vue.prototype.selectItemsLabel = selectItemsLabel
  37. Vue.prototype.download = download
  38. // 全局组件挂载
  39. Vue.component('Pagination', Pagination)
  40. Vue.component('BasicLayout', BasicLayout)
  41. Vue.prototype.msgSuccess = function(msg) {
  42. this.$message({ showClose: true, message: msg, type: 'success' })
  43. }
  44. Vue.prototype.msgError = function(msg) {
  45. this.$message({ showClose: true, message: msg, type: 'error' })
  46. }
  47. Vue.prototype.msgInfo = function(msg) {
  48. this.$message.info(msg)
  49. }
  50. Vue.use(permission)
  51. Vue.use(Element, {
  52. size: Cookies.get('size') || 'medium' // set element-ui default size
  53. })
  54. import VueDND from 'awe-dnd'
  55. Vue.use(VueDND)
  56. import 'remixicon/fonts/remixicon.css'
  57. console.info(`欢迎使用go-admin,谢谢您对我们的支持,在使用过程中如果有什么问题,
  58. 请访问https://github.com/go-admin-team/go-admin 或者
  59. https://github.com/go-admin-team/go-admin-ui 向我们反馈,
  60. 谢谢!`)
  61. // register global utility filters
  62. Object.keys(filters).forEach(key => {
  63. Vue.filter(key, filters[key])
  64. })
  65. Vue.config.productionTip = false
  66. new Vue({
  67. el: '#app',
  68. router,
  69. store,
  70. render: h => h(App)
  71. })