1. 效果演示

一个简单的人员信息登记表:
点此在线运行代码:https://jsbin.com/mihubem/edit?html,output
image.png

2. 在线体验

表单JSON如下,复制JSON,在表单设计器(点此进入)中选择“导入JSON”即可看到效果:

  1. {
  2. "widgetList": [
  3. {
  4. "type": "grid",
  5. "category": "container",
  6. "icon": "grid",
  7. "cols": [
  8. {
  9. "type": "grid-col",
  10. "category": "container",
  11. "icon": "grid-col",
  12. "internal": true,
  13. "widgetList": [
  14. {
  15. "type": "static-text",
  16. "icon": "static-text",
  17. "formItemFlag": false,
  18. "options": {
  19. "name": "static-text20799",
  20. "columnWidth": "200px",
  21. "hidden": false,
  22. "textContent": "人员登记表",
  23. "customClass": [],
  24. "onCreated": "",
  25. "onMounted": "",
  26. "label": "static-text"
  27. },
  28. "displayName": "静态文字",
  29. "id": "static-text20799"
  30. }
  31. ],
  32. "options": {
  33. "name": "gridCol96077",
  34. "hidden": false,
  35. "span": 12,
  36. "customClass": []
  37. },
  38. "id": "grid-col-96077"
  39. }
  40. ],
  41. "options": {
  42. "name": "grid64343",
  43. "hidden": false,
  44. "gutter": 12,
  45. "customClass": []
  46. },
  47. "displayName": "栅格",
  48. "id": "grid64343"
  49. },
  50. {
  51. "type": "grid",
  52. "category": "container",
  53. "icon": "grid",
  54. "cols": [
  55. {
  56. "type": "grid-col",
  57. "category": "container",
  58. "icon": "grid-col",
  59. "internal": true,
  60. "widgetList": [
  61. {
  62. "type": "input",
  63. "icon": "text-field",
  64. "formItemFlag": true,
  65. "options": {
  66. "name": "input97458",
  67. "label": "姓名",
  68. "labelAlign": "",
  69. "type": "text",
  70. "defaultValue": "",
  71. "placeholder": "",
  72. "columnWidth": "200px",
  73. "size": "",
  74. "labelWidth": null,
  75. "labelHidden": false,
  76. "readonly": false,
  77. "disabled": false,
  78. "hidden": false,
  79. "clearable": true,
  80. "showPassword": false,
  81. "required": true,
  82. "validation": "",
  83. "validationHint": "",
  84. "customClass": [],
  85. "labelIconClass": null,
  86. "labelIconPosition": "rear",
  87. "labelTooltip": null,
  88. "minLength": null,
  89. "maxLength": null,
  90. "showWordLimit": false,
  91. "prefixIcon": "",
  92. "suffixIcon": "",
  93. "appendButton": false,
  94. "buttonDisabled": false,
  95. "buttonIcon": "el-icon-search",
  96. "onCreated": "",
  97. "onMounted": "",
  98. "onChange": "",
  99. "onFocus": "",
  100. "onBlur": "",
  101. "onValidate": ""
  102. },
  103. "displayName": "单行输入",
  104. "id": "input97458"
  105. }
  106. ],
  107. "options": {
  108. "name": "gridCol66750",
  109. "hidden": false,
  110. "span": 12
  111. },
  112. "id": "grid-col-66750"
  113. },
  114. {
  115. "type": "grid-col",
  116. "category": "container",
  117. "icon": "grid-col",
  118. "internal": true,
  119. "widgetList": [
  120. {
  121. "type": "radio",
  122. "icon": "radio-field",
  123. "formItemFlag": true,
  124. "options": {
  125. "name": "radio61394",
  126. "label": "性别",
  127. "labelAlign": "",
  128. "defaultValue": 3,
  129. "columnWidth": "200px",
  130. "size": "",
  131. "displayStyle": "inline",
  132. "labelWidth": null,
  133. "labelHidden": false,
  134. "disabled": false,
  135. "hidden": false,
  136. "optionItems": [
  137. {
  138. "label": "女士",
  139. "value": 1
  140. },
  141. {
  142. "label": "先生",
  143. "value": 2
  144. },
  145. {
  146. "label": "无可奉告",
  147. "value": 3
  148. }
  149. ],
  150. "required": false,
  151. "validation": "",
  152. "validationHint": "",
  153. "customClass": [],
  154. "labelIconClass": null,
  155. "labelIconPosition": "rear",
  156. "labelTooltip": null,
  157. "onCreated": "",
  158. "onMounted": "",
  159. "onChange": "",
  160. "onValidate": ""
  161. },
  162. "displayName": "单选项",
  163. "id": "radio61394"
  164. }
  165. ],
  166. "options": {
  167. "name": "gridCol16505",
  168. "hidden": false,
  169. "span": 12
  170. },
  171. "id": "grid-col-16505"
  172. }
  173. ],
  174. "options": {
  175. "name": "grid88004",
  176. "hidden": false,
  177. "gutter": 12,
  178. "customClass": []
  179. },
  180. "displayName": "栅格",
  181. "id": "grid88004"
  182. },
  183. {
  184. "type": "grid",
  185. "category": "container",
  186. "icon": "grid",
  187. "cols": [
  188. {
  189. "type": "grid-col",
  190. "category": "container",
  191. "icon": "grid-col",
  192. "internal": true,
  193. "widgetList": [
  194. {
  195. "type": "number",
  196. "icon": "number-field",
  197. "formItemFlag": true,
  198. "options": {
  199. "name": "number106358",
  200. "label": "年龄",
  201. "labelAlign": "",
  202. "defaultValue": "18",
  203. "placeholder": "",
  204. "columnWidth": "200px",
  205. "size": "",
  206. "labelWidth": null,
  207. "labelHidden": false,
  208. "disabled": false,
  209. "hidden": false,
  210. "required": true,
  211. "validation": "",
  212. "validationHint": "",
  213. "customClass": [],
  214. "labelIconClass": "el-icon-question",
  215. "labelIconPosition": "rear",
  216. "labelTooltip": "年龄大于18岁的成年人方可登记",
  217. "min": 0,
  218. "max": 100,
  219. "precision": 0,
  220. "step": 1,
  221. "controlsPosition": "right",
  222. "onCreated": "",
  223. "onMounted": "",
  224. "onChange": "",
  225. "onFocus": "",
  226. "onBlur": "",
  227. "onValidate": ""
  228. },
  229. "displayName": "计数器",
  230. "id": "number106358"
  231. }
  232. ],
  233. "options": {
  234. "name": "gridCol101163",
  235. "hidden": false,
  236. "span": 12
  237. },
  238. "id": "grid-col-101163"
  239. },
  240. {
  241. "type": "grid-col",
  242. "category": "container",
  243. "icon": "grid-col",
  244. "internal": true,
  245. "widgetList": [
  246. {
  247. "type": "select",
  248. "icon": "select-field",
  249. "formItemFlag": true,
  250. "options": {
  251. "name": "select62173",
  252. "label": "教育程度",
  253. "labelAlign": "",
  254. "defaultValue": "",
  255. "placeholder": "",
  256. "columnWidth": "200px",
  257. "size": "",
  258. "labelWidth": null,
  259. "labelHidden": false,
  260. "disabled": false,
  261. "hidden": false,
  262. "clearable": true,
  263. "filterable": false,
  264. "allowCreate": false,
  265. "remote": false,
  266. "automaticDropdown": false,
  267. "multiple": false,
  268. "multipleLimit": 0,
  269. "optionItems": [
  270. {
  271. "value": "1",
  272. "label": "社会人"
  273. },
  274. {
  275. "value": "2",
  276. "label": "高中"
  277. },
  278. {
  279. "value": "3",
  280. "label": "大学"
  281. },
  282. {
  283. "value": "4",
  284. "label": "研究生"
  285. },
  286. {
  287. "value": "5",
  288. "label": "博士及以上"
  289. }
  290. ],
  291. "required": true,
  292. "validation": "",
  293. "validationHint": "",
  294. "customClass": [],
  295. "labelIconClass": null,
  296. "labelIconPosition": "rear",
  297. "labelTooltip": null,
  298. "onCreated": "",
  299. "onMounted": "",
  300. "onRemoteQuery": "",
  301. "onChange": "",
  302. "onFocus": "",
  303. "onBlur": "",
  304. "onValidate": ""
  305. },
  306. "displayName": "下拉选项",
  307. "id": "select62173"
  308. }
  309. ],
  310. "options": {
  311. "name": "gridCol46272",
  312. "hidden": false,
  313. "span": 12,
  314. "customClass": []
  315. },
  316. "id": "grid-col-46272"
  317. }
  318. ],
  319. "options": {
  320. "name": "grid75579",
  321. "hidden": false,
  322. "gutter": 12
  323. },
  324. "id": "grid75579"
  325. }
  326. ],
  327. "formConfig": {
  328. "labelWidth": 80,
  329. "labelPosition": "left",
  330. "size": "",
  331. "labelAlign": "label-left-align",
  332. "cssCode": "",
  333. "customClass": "",
  334. "functions": "",
  335. "layoutType": "PC",
  336. "onFormCreated": "",
  337. "onFormMounted": "",
  338. "onFormDataChange": "",
  339. "onFormValidate": ""
  340. }
  341. }