install.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import axios from 'axios'
  2. import VFormDesigner from '@/components/form-designer/index.vue'
  3. import VFormRender from '@/components/form-render/index.vue'
  4. import Draggable from '@/../lib/vuedraggable/dist/vuedraggable.umd.js'
  5. import {registerIcon} from '@/utils/el-icons'
  6. import 'virtual:svg-icons-register'
  7. import '@/iconfont/iconfont.css'
  8. import ContainerWidgets from '@/components/form-designer/form-widget/container-widget/index'
  9. import ContainerItems from '@/components/form-render/container-item/index'
  10. import { addDirective } from '@/utils/directive'
  11. import { installI18n } from '@/utils/i18n'
  12. import { loadExtension } from '@/extension/extension-loader'
  13. VFormDesigner.install = function (app) {
  14. addDirective(app)
  15. installI18n(app)
  16. loadExtension(app)
  17. app.use(ContainerWidgets)
  18. app.use(ContainerItems)
  19. registerIcon(app)
  20. app.component('draggable', Draggable)
  21. app.component(VFormDesigner.name, VFormDesigner)
  22. }
  23. VFormRender.install = function (app) {
  24. installI18n(app)
  25. loadExtension(app)
  26. app.use(ContainerItems)
  27. registerIcon(app)
  28. app.component(VFormRender.name, VFormRender)
  29. }
  30. const components = [
  31. VFormDesigner,
  32. VFormRender
  33. ]
  34. const install = (app) => {
  35. addDirective(app)
  36. installI18n(app)
  37. loadExtension(app)
  38. app.use(ContainerWidgets)
  39. app.use(ContainerItems)
  40. registerIcon(app)
  41. app.component('draggable', Draggable)
  42. components.forEach(component => {
  43. app.component(component.name, component)
  44. })
  45. window.axios = axios
  46. }
  47. if (typeof window !== 'undefined' && window.Vue) { /* script·½Ê½ÒýÈëʱ¸³Öµaxios£¡£¡ */
  48. //window.axios = axios
  49. }
  50. export default {
  51. install,
  52. VFormDesigner,
  53. VFormRender
  54. }