main.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import Vue from 'vue'
  2. import directive from './directive'
  3. import 'normalize.css/normalize.css' // A modern alternative to CSS resets
  4. import ElementUI, {Message, MessageBox} from 'element-ui'
  5. import 'element-ui/lib/theme-chalk/index.css'
  6. import locale from 'element-ui/lib/locale/lang/zh-CN' // lang i18n
  7. import 'font-awesome/scss/font-awesome.scss'
  8. import '@/styles/index.scss' // global css
  9. import 'xe-utils'
  10. import moment from 'moment'
  11. import plugins from './plugins' // plugins
  12. import App from './App'
  13. import store from './store'
  14. import router, {resetRouter} from './router'
  15. import '@/icons' // icon
  16. import '@/permission' // permission control
  17. // import axios from 'axios'
  18. import VXETable from 'vxe-table'
  19. import 'vxe-table/lib/index.css'
  20. import service from './utils/request'
  21. import {removeToken} from './utils/auth'
  22. // import { resetForm} from "@/utils/index"
  23. import { parseTime, resetForm, addDateRange, selectDictLabel, selectDictLabels, handleTree } from "@/utils/ruoyi"
  24. Vue.prototype.$moment = moment
  25. Vue.prototype.$axios = service
  26. Vue.use(VXETable)
  27. Vue.use(plugins)
  28. Vue.use(directive)
  29. Vue.prototype.handleTree = handleTree
  30. /**
  31. * If you don't want to use mock-server
  32. * you want to use MockJs for mock api
  33. * you can execute: mockXHR()
  34. *
  35. * Currently MockJs will be used in the production environment,
  36. * please remove it before going online ! ! !
  37. */
  38. /* if (process.env.NODE_ENV === 'production') {
  39. const { mockXHR } = require('../mock')
  40. mockXHR()
  41. }*/
  42. // set ElementUI lang to EN
  43. Vue.use(ElementUI, {locale})
  44. // 如果想要中文版 element-ui,按如下方式声明
  45. // Vue.use(ElementUI)
  46. Vue.prototype.$fpath = require('path')
  47. Vue.config.productionTip = false
  48. VXETable.setup({
  49. validArgs: 'obsolete' // 将自定义校验参数还原为 Function(rule, cellValue, callback)
  50. })
  51. Vue.prototype.resetForm = resetForm
  52. Vue.prototype.parseTime = parseTime
  53. new Vue({
  54. el: '#app',
  55. router,
  56. store,
  57. render: h => h(App)
  58. })