main.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 App from './App'
  8. import store from './store'
  9. import router from './router'
  10. import i18n from './lang' // internationalization
  11. import './icons' // icon
  12. import './permission' // permission control
  13. import './utils/error-log' // error log
  14. import * as filters from './filters' // global filters
  15. import VFormRender from './lib/VFormRender.umd' //引入VFormRender组件
  16. import './lib/VFormRender.css' //引入VForm样式
  17. import {formMethod,commonUtil} from './apis/form-common'
  18. /**
  19. * If you don't want to use mock-server
  20. * you want to use MockJs for mock api
  21. * you can execute: mockXHR()
  22. *
  23. * Currently MockJs will be used in the production environment,
  24. * please remove it before going online ! ! !
  25. */
  26. if (process.env.NODE_ENV === 'production') {
  27. const {mockXHR} = require('../mock')
  28. mockXHR()
  29. }
  30. Vue.directive('dialogDrag',{
  31. bind(el,binding,vnode){
  32. // console.log(el);
  33. }
  34. })
  35. Vue.use(Element, {
  36. size: Cookies.get('size') || 'medium', // set element-ui default size
  37. i18n: (key, value) => i18n.t(key, value)
  38. })
  39. Vue.use(VFormRender) //全局注册VForm(同时注册了v-form-designer和v-form-render组件)
  40. // register global utility filters
  41. Object.keys(filters).forEach(key => {
  42. Vue.filter(key, filters[key])
  43. })
  44. Vue.config.productionTip = false
  45. /**
  46. * 表单通用方法
  47. */
  48. Vue.prototype.$FormCommonApi = formMethod
  49. Vue.prototype.$CommonUtil = commonUtil
  50. new Vue({
  51. el: '#app',
  52. router,
  53. store,
  54. i18n,
  55. render: h => h(App)
  56. })