main.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import Vue from 'vue'
  2. import axios from 'axios'
  3. import Cookies from 'js-cookie'
  4. import 'normalize.css/normalize.css' // a modern alternative to CSS resets
  5. import Element from 'element-ui'
  6. import './styles/element-variables.scss'
  7. import '@/styles/index.scss' // global css
  8. import '@/styles/custom.scss' // global css
  9. import App from './App'
  10. import store from './store'
  11. import router from './router'
  12. import i18n from './lang' // internationalization
  13. import './icons' // icon
  14. import './permission' // permission control
  15. import './utils/error-log' // error log
  16. import Pagination from '@/components/Pagination'
  17. import * as filters from './filters'
  18. import tools from './utils/tools'
  19. import { resetForm, findArrayById } from './utils/jingmiao'
  20. import checkPermission from '@/utils/permission'
  21. Vue.component('Pagination', Pagination)
  22. /**
  23. * If you don't want to use mock-server
  24. * you want to use MockJs for mock api
  25. * you can execute: mockXHR()
  26. *
  27. * Currently MockJs will be used in the production environment,
  28. * please remove it before going online ! ! !
  29. */
  30. // if (process.env.NODE_ENV === 'production') {
  31. // const { mockXHR } = require('../mock')
  32. // mockXHR()
  33. // }
  34. Vue.prototype.axios = axios
  35. // 注册全局指令
  36. import elDragDialog from './directive/el-drag-dialog'
  37. Vue.use(elDragDialog, { directiveName: 'el-drag-dialog' })
  38. Vue.use(Element, {
  39. size: Cookies.get('size') || 'small', // set element-ui default size
  40. i18n: (key, value) => i18n.t(key, value)
  41. })
  42. // register global utility filters
  43. Object.keys(filters).forEach(key => {
  44. Vue.filter(key, filters[key])
  45. })
  46. const domain = 'http://f.ssdogdog.com/'
  47. const defaultPhotoUrl = 'user/a/177ea862-f8c0fcf889a55b2f-0x0.jpg'
  48. Vue.prototype.GLOBAL = {
  49. domain,
  50. defaultPhotoUrl
  51. }
  52. Vue.prototype.TOOLS = tools
  53. Vue.prototype.checkPermission = checkPermission
  54. Vue.prototype.resetForm = resetForm
  55. Vue.filter('formatSingleInArray', findArrayById)
  56. new Vue({
  57. el: '#app',
  58. router,
  59. store,
  60. i18n,
  61. render: h => h(App)
  62. })