main.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * @Descripttion:
  3. * @Author: kcz
  4. * @Date: 2021-05-02 16:04:02
  5. * @LastEditors: kcz
  6. * @LastEditTime: 2021-05-21 13:55:46
  7. */
  8. // 引入@babel/polyfill处理兼容
  9. import "@babel/polyfill";
  10. import Vue from "vue";
  11. import App from "./App.vue";
  12. import router from "./router/";
  13. import KFormDesign from "../packages/index";
  14. import Cmp from "./components/CustomComponent/index.vue";
  15. // const Cmp = {
  16. // name: "cmp",
  17. // render: function(h) {
  18. // return h("div", "我是自定义组件");
  19. // }
  20. // };
  21. KFormDesign.setFormDesignConfig({
  22. title: "数据字段",
  23. list: [
  24. {
  25. type: "input", // 表单类型
  26. label: "自定义组件", // 标题文字
  27. icon: "icon-gallery",
  28. component: Cmp,
  29. options: {
  30. type:'CustomComponents',
  31. defaultValue: undefined,
  32. multiple: false,
  33. disabled: false,
  34. width: "100%",
  35. clearable: true,
  36. placeholder: "请选择",
  37. showSearch: false
  38. },
  39. model: "",
  40. key: "",
  41. rules: [
  42. {
  43. required: false,
  44. message: "必填项"
  45. }
  46. ]
  47. },
  48. {
  49. type: "input", // 表单类型
  50. label: "当前用户", // 标题文字
  51. icon: "icon-write",
  52. options: {
  53. type: "CurrentUser",
  54. width: "100%", // 宽度
  55. defaultValue: "", // 默认值
  56. placeholder: "请输入", // 没有输入时,提示文字
  57. clearable: false,
  58. maxLength: null,
  59. addonBefore: "",
  60. addonAfter: "",
  61. hidden: false, // 是否隐藏,false显示,true隐藏
  62. disabled: true // 是否禁用,false不禁用,true禁用
  63. },
  64. model: "", // 数据字段
  65. key: "",
  66. help: "",
  67. rules: [
  68. //验证规则
  69. {
  70. required: false, // 必须填写
  71. message: "必填项"
  72. }
  73. ]
  74. },
  75. {
  76. type: "input", // 表单类型
  77. label: "当前部门", // 标题文字
  78. icon: "icon-write",
  79. options: {
  80. type: "CurrentDepartment",
  81. width: "100%", // 宽度
  82. defaultValue: "", // 默认值
  83. placeholder: "请输入", // 没有输入时,提示文字
  84. clearable: false,
  85. maxLength: null,
  86. addonBefore: "",
  87. addonAfter: "",
  88. hidden: false, // 是否隐藏,false显示,true隐藏
  89. disabled: true // 是否禁用,false不禁用,true禁用
  90. },
  91. model: "", // 数据字段
  92. key: "",
  93. help: "",
  94. rules: [
  95. //验证规则
  96. {
  97. required: false, // 必须填写
  98. message: "必填项"
  99. }
  100. ]
  101. },
  102. ],
  103. uploadFile: "",
  104. uploadImage: "",
  105. uploadFileName: "",
  106. uploadImageName: "",
  107. uploadFileData: { data: 1545 },
  108. uploadImageData: { data: 1545 },
  109. uploadFileHeaders: { data: 1545 },
  110. uploadImageHeaders: { data: 1545 }
  111. });
  112. Vue.use(KFormDesign);
  113. // KFormDesign.setFormBuildConfig({
  114. // dynamicData: {
  115. // test: [
  116. // { label: "test", value: "1" },
  117. // { label: "test1", value: "2" }
  118. // ]
  119. // }
  120. // });
  121. Vue.config.productionTip = false;
  122. new Vue({
  123. router,
  124. render: h => h(App)
  125. }).$mount("#app");