tianheng-ui 0.0.47 → 0.0.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -11
- package/lib/iconfont.svg +155 -155
- package/lib/index.js +3 -3
- package/lib/tianheng-ui.js +3 -3
- package/package.json +1 -1
- package/packages/dialog/index.vue +4 -1
- package/packages/formMaking/Container.vue +591 -601
- package/packages/formMaking/CusDialog.vue +134 -134
- package/packages/formMaking/FormConfig.vue +40 -40
- package/packages/formMaking/GenerateForm.vue +176 -184
- package/packages/formMaking/GenerateFormItem.vue +203 -17
- package/packages/formMaking/Upload/index.vue +572 -572
- package/packages/formMaking/WidgetConfig.vue +212 -34
- package/packages/formMaking/WidgetForm.vue +134 -268
- package/packages/formMaking/WidgetFormItem.vue +382 -30
- package/packages/formMaking/componentsConfig.js +159 -14
- package/packages/formMaking/generateCode.js +163 -155
- package/packages/formMaking/iconfont/demo.css +539 -539
- package/packages/formMaking/iconfont/demo_index.html +1159 -1159
- package/packages/formMaking/iconfont/iconfont.css +189 -189
- package/packages/formMaking/iconfont/iconfont.svg +155 -155
- package/packages/formMaking/index.js +77 -77
- package/packages/formMaking/lang/en-US.js +187 -187
- package/packages/formMaking/lang/zh-CN.js +187 -187
- package/packages/formMaking/styles/cover.scss +3 -3
- package/packages/formMaking/styles/index.scss +768 -746
- package/packages/formMaking/util/index.js +32 -32
- package/packages/formMaking/util/request.js +28 -28
- package/packages/table/search.vue +46 -37
@@ -5,6 +5,8 @@ export const basicComponents = [
|
|
5
5
|
icon: "icon-input",
|
6
6
|
options: {
|
7
7
|
width: "100%",
|
8
|
+
labelWidth: 100,
|
9
|
+
isLabelWidth: false,
|
8
10
|
defaultValue: "",
|
9
11
|
dataType: "string",
|
10
12
|
pattern: "",
|
@@ -28,6 +30,8 @@ export const basicComponents = [
|
|
28
30
|
icon: "icon-diy-com-textarea",
|
29
31
|
options: {
|
30
32
|
width: "100%",
|
33
|
+
labelWidth: 100,
|
34
|
+
isLabelWidth: false,
|
31
35
|
defaultValue: "",
|
32
36
|
pattern: "",
|
33
37
|
placeholder: "",
|
@@ -50,6 +54,8 @@ export const basicComponents = [
|
|
50
54
|
icon: "icon-number",
|
51
55
|
options: {
|
52
56
|
width: "40%",
|
57
|
+
labelWidth: 100,
|
58
|
+
isLabelWidth: false,
|
53
59
|
required: false,
|
54
60
|
defaultValue: 0,
|
55
61
|
min: 1,
|
@@ -66,6 +72,9 @@ export const basicComponents = [
|
|
66
72
|
type: "radio",
|
67
73
|
icon: "icon-radio-active",
|
68
74
|
options: {
|
75
|
+
width: "",
|
76
|
+
labelWidth: 100,
|
77
|
+
isLabelWidth: false,
|
69
78
|
inline: false,
|
70
79
|
defaultValue: "",
|
71
80
|
showLabel: false,
|
@@ -84,7 +93,6 @@ export const basicComponents = [
|
|
84
93
|
}
|
85
94
|
],
|
86
95
|
required: false,
|
87
|
-
width: "",
|
88
96
|
remote: false,
|
89
97
|
remoteOptions: [],
|
90
98
|
props: {
|
@@ -102,6 +110,9 @@ export const basicComponents = [
|
|
102
110
|
type: "checkbox",
|
103
111
|
icon: "icon-check-box",
|
104
112
|
options: {
|
113
|
+
width: "",
|
114
|
+
labelWidth: 100,
|
115
|
+
isLabelWidth: false,
|
105
116
|
inline: false,
|
106
117
|
defaultValue: [],
|
107
118
|
showLabel: false,
|
@@ -117,7 +128,6 @@ export const basicComponents = [
|
|
117
128
|
}
|
118
129
|
],
|
119
130
|
required: false,
|
120
|
-
width: "",
|
121
131
|
remote: false,
|
122
132
|
remoteOptions: [],
|
123
133
|
props: {
|
@@ -137,6 +147,9 @@ export const basicComponents = [
|
|
137
147
|
type: "time",
|
138
148
|
icon: "icon-time",
|
139
149
|
options: {
|
150
|
+
width: "",
|
151
|
+
labelWidth: 100,
|
152
|
+
isLabelWidth: false,
|
140
153
|
defaultValue: "21:19:56",
|
141
154
|
readonly: false,
|
142
155
|
disabled: false,
|
@@ -149,7 +162,6 @@ export const basicComponents = [
|
|
149
162
|
arrowControl: true,
|
150
163
|
format: "HH:mm:ss",
|
151
164
|
required: false,
|
152
|
-
width: "",
|
153
165
|
timeType: true, //任意时间范围,时间点
|
154
166
|
selectRange: false, //时间点情况下的时间范围
|
155
167
|
selectStartTime: "", //时间点情况下的开始的时间
|
@@ -172,6 +184,9 @@ export const basicComponents = [
|
|
172
184
|
type: "date",
|
173
185
|
icon: "icon-date",
|
174
186
|
options: {
|
187
|
+
width: "",
|
188
|
+
labelWidth: 100,
|
189
|
+
isLabelWidth: false,
|
175
190
|
defaultValue: "",
|
176
191
|
readonly: false,
|
177
192
|
disabled: false,
|
@@ -183,8 +198,7 @@ export const basicComponents = [
|
|
183
198
|
type: "date",
|
184
199
|
format: "yyyy-MM-dd",
|
185
200
|
timestamp: false,
|
186
|
-
required: false
|
187
|
-
width: ""
|
201
|
+
required: false
|
188
202
|
}
|
189
203
|
},
|
190
204
|
{
|
@@ -192,6 +206,8 @@ export const basicComponents = [
|
|
192
206
|
type: "rate",
|
193
207
|
icon: "icon-pingfen1",
|
194
208
|
options: {
|
209
|
+
labelWidth: 100,
|
210
|
+
isLabelWidth: false,
|
195
211
|
defaultValue: null,
|
196
212
|
max: 5,
|
197
213
|
disabled: false,
|
@@ -206,6 +222,8 @@ export const basicComponents = [
|
|
206
222
|
type: "color",
|
207
223
|
icon: "icon-color",
|
208
224
|
options: {
|
225
|
+
labelWidth: 100,
|
226
|
+
isLabelWidth: false,
|
209
227
|
defaultValue: "",
|
210
228
|
disabled: false,
|
211
229
|
showAlpha: false,
|
@@ -217,6 +235,9 @@ export const basicComponents = [
|
|
217
235
|
type: "select",
|
218
236
|
icon: "icon-select",
|
219
237
|
options: {
|
238
|
+
width: "",
|
239
|
+
labelWidth: 100,
|
240
|
+
isLabelWidth: false,
|
220
241
|
defaultValue: "",
|
221
242
|
multiple: false,
|
222
243
|
disabled: false,
|
@@ -226,7 +247,6 @@ export const basicComponents = [
|
|
226
247
|
showLabel: false,
|
227
248
|
collapseTags: false,
|
228
249
|
allowCreate: false,
|
229
|
-
width: "",
|
230
250
|
options: [
|
231
251
|
{
|
232
252
|
value: "Option 1"
|
@@ -253,6 +273,8 @@ export const basicComponents = [
|
|
253
273
|
type: "switch",
|
254
274
|
icon: "icon-switch",
|
255
275
|
options: {
|
276
|
+
labelWidth: 100,
|
277
|
+
isLabelWidth: false,
|
256
278
|
defaultValue: false,
|
257
279
|
required: false,
|
258
280
|
disabled: false,
|
@@ -267,6 +289,10 @@ export const basicComponents = [
|
|
267
289
|
type: "slider",
|
268
290
|
icon: "icon-slider",
|
269
291
|
options: {
|
292
|
+
width: "",
|
293
|
+
height: "",
|
294
|
+
labelWidth: 100,
|
295
|
+
isLabelWidth: false,
|
270
296
|
defaultValue: 0,
|
271
297
|
disabled: false,
|
272
298
|
required: false,
|
@@ -276,8 +302,6 @@ export const basicComponents = [
|
|
276
302
|
showInput: false,
|
277
303
|
range: false,
|
278
304
|
vertical: false,
|
279
|
-
width: "",
|
280
|
-
height: "",
|
281
305
|
showTooltip: true,
|
282
306
|
formatTooltip: 1, //格式化
|
283
307
|
showStops: false //间断点
|
@@ -288,9 +312,40 @@ export const basicComponents = [
|
|
288
312
|
type: "text",
|
289
313
|
icon: "icon-wenzishezhi-",
|
290
314
|
options: {
|
291
|
-
|
315
|
+
labelWidth: 100,
|
316
|
+
isLabelWidth: false,
|
317
|
+
hideLabel: true,
|
318
|
+
defaultValue: "文字内容",
|
292
319
|
customClass: ""
|
293
320
|
}
|
321
|
+
},
|
322
|
+
{
|
323
|
+
type: "button",
|
324
|
+
icon: "icon-button",
|
325
|
+
options: {
|
326
|
+
customClass: "",
|
327
|
+
disabled: false,
|
328
|
+
labelWidth: 100,
|
329
|
+
isLabelWidth: false,
|
330
|
+
hideLabel: true,
|
331
|
+
hidden: false,
|
332
|
+
dataBind: false,
|
333
|
+
buttonSize: "small",
|
334
|
+
buttonType: "",
|
335
|
+
buttonPlain: false,
|
336
|
+
buttonRound: false,
|
337
|
+
buttonCircle: false,
|
338
|
+
buttonName: "Button",
|
339
|
+
width: "",
|
340
|
+
remoteFunc: "",
|
341
|
+
remoteOption: "",
|
342
|
+
tableColumn: false
|
343
|
+
},
|
344
|
+
events: {
|
345
|
+
onClick: ""
|
346
|
+
},
|
347
|
+
name: "按钮",
|
348
|
+
rules: []
|
294
349
|
}
|
295
350
|
];
|
296
351
|
|
@@ -304,16 +359,18 @@ export const advanceComponents = [
|
|
304
359
|
}
|
305
360
|
},
|
306
361
|
{
|
307
|
-
name: "
|
362
|
+
name: "文件",
|
308
363
|
type: "imgupload",
|
309
364
|
icon: "icon-tupian",
|
310
365
|
options: {
|
366
|
+
width: "",
|
367
|
+
labelWidth: 100,
|
368
|
+
isLabelWidth: false,
|
311
369
|
defaultValue: [],
|
312
370
|
size: {
|
313
371
|
width: 100,
|
314
372
|
height: 100
|
315
373
|
},
|
316
|
-
width: "",
|
317
374
|
tokenFunc: "funcGetToken",
|
318
375
|
token: "",
|
319
376
|
domain: "https://tcdn.form.making.link/",
|
@@ -340,9 +397,11 @@ export const advanceComponents = [
|
|
340
397
|
type: "editor",
|
341
398
|
icon: "icon-fuwenbenkuang",
|
342
399
|
options: {
|
343
|
-
defaultValue: "",
|
344
400
|
width: "",
|
345
401
|
height: "",
|
402
|
+
labelWidth: 100,
|
403
|
+
isLabelWidth: false,
|
404
|
+
defaultValue: "",
|
346
405
|
disabled: false,
|
347
406
|
required: false
|
348
407
|
}
|
@@ -352,8 +411,10 @@ export const advanceComponents = [
|
|
352
411
|
type: "cascader",
|
353
412
|
icon: "icon-jilianxuanze",
|
354
413
|
options: {
|
355
|
-
defaultValue: [],
|
356
414
|
width: "",
|
415
|
+
labelWidth: 100,
|
416
|
+
isLabelWidth: false,
|
417
|
+
defaultValue: [],
|
357
418
|
placeholder: "",
|
358
419
|
disabled: false,
|
359
420
|
clearable: false,
|
@@ -375,6 +436,38 @@ export const advanceComponents = [
|
|
375
436
|
},
|
376
437
|
remoteFunc: ""
|
377
438
|
}
|
439
|
+
},
|
440
|
+
{
|
441
|
+
name: "子表单",
|
442
|
+
type: "table",
|
443
|
+
icon: "icon-table",
|
444
|
+
options: {
|
445
|
+
defaultValue: [],
|
446
|
+
customClass: "",
|
447
|
+
labelWidth: 100,
|
448
|
+
isLabelWidth: false,
|
449
|
+
hideLabel: false,
|
450
|
+
hidden: false,
|
451
|
+
dataBind: true,
|
452
|
+
disabled: false,
|
453
|
+
required: false,
|
454
|
+
validatorCheck: false,
|
455
|
+
validator: "",
|
456
|
+
paging: false,
|
457
|
+
pageSize: 5,
|
458
|
+
isAdd: true,
|
459
|
+
isDelete: true,
|
460
|
+
isSerial: true,
|
461
|
+
remoteFunc: "",
|
462
|
+
remoteOption: "",
|
463
|
+
tableColumn: false
|
464
|
+
},
|
465
|
+
events: {
|
466
|
+
onChange: "",
|
467
|
+
onRowAdd: "",
|
468
|
+
onRowRemove: ""
|
469
|
+
},
|
470
|
+
list: []
|
378
471
|
}
|
379
472
|
];
|
380
473
|
|
@@ -396,7 +489,59 @@ export const layoutComponents = [
|
|
396
489
|
options: {
|
397
490
|
gutter: 0,
|
398
491
|
justify: "start",
|
399
|
-
align: "top"
|
492
|
+
align: "top",
|
493
|
+
// labelWidth: 100,
|
494
|
+
// isLabelWidth: false,
|
495
|
+
hideLabel: true
|
400
496
|
}
|
497
|
+
},
|
498
|
+
{
|
499
|
+
type: "tabs",
|
500
|
+
icon: "icon-tabs",
|
501
|
+
tabs: [
|
502
|
+
{
|
503
|
+
label: "选项1",
|
504
|
+
value: "tab_1",
|
505
|
+
list: []
|
506
|
+
},
|
507
|
+
{
|
508
|
+
label: "选项2",
|
509
|
+
value: "tab_2",
|
510
|
+
list: []
|
511
|
+
}
|
512
|
+
],
|
513
|
+
options: {
|
514
|
+
defaultValue: "tab_1",
|
515
|
+
type: "",
|
516
|
+
tabPosition: "top",
|
517
|
+
customClass: "",
|
518
|
+
hidden: false,
|
519
|
+
labelWidth: 100,
|
520
|
+
isLabelWidth: false,
|
521
|
+
hideLabel: true,
|
522
|
+
remote: false,
|
523
|
+
remoteFunc: "",
|
524
|
+
remoteOption: "",
|
525
|
+
tableColumn: false
|
526
|
+
},
|
527
|
+
name: "标签页",
|
528
|
+
rules: []
|
529
|
+
},
|
530
|
+
{
|
531
|
+
name: "分割线",
|
532
|
+
type: "divider",
|
533
|
+
icon: "icon-fengexian",
|
534
|
+
options: {
|
535
|
+
height: 50,
|
536
|
+
hidden: false,
|
537
|
+
labelWidth: 100,
|
538
|
+
isLabelWidth: false,
|
539
|
+
hideLabel: true,
|
540
|
+
contentPosition: "left",
|
541
|
+
remoteFunc: "",
|
542
|
+
remoteOption: "",
|
543
|
+
tableColumn: false
|
544
|
+
},
|
545
|
+
rules: []
|
401
546
|
}
|
402
547
|
];
|
@@ -1,155 +1,163 @@
|
|
1
|
-
function findRemoteFunc
|
2
|
-
for (let i = 0; i < list.length; i++) {
|
3
|
-
if (list[i].type ==
|
4
|
-
list[i].columns.forEach(item => {
|
5
|
-
findRemoteFunc(item.list, funcList, tokenFuncList, blankList)
|
6
|
-
})
|
7
|
-
} else {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
})
|
22
|
-
}
|
23
|
-
} else {
|
24
|
-
if (list[i].options.
|
25
|
-
|
26
|
-
func: list[i].options.
|
27
|
-
label: list[i].name,
|
28
|
-
model: list[i].model
|
29
|
-
})
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
<
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
<
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
}
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
}
|
1
|
+
function findRemoteFunc(list, funcList, tokenFuncList, blankList) {
|
2
|
+
for (let i = 0; i < list.length; i++) {
|
3
|
+
if (list[i].type == "grid") {
|
4
|
+
list[i].columns.forEach(item => {
|
5
|
+
findRemoteFunc(item.list, funcList, tokenFuncList, blankList);
|
6
|
+
});
|
7
|
+
} else if (list[i].type == "tabs") {
|
8
|
+
list[i].tabs.forEach(item => {
|
9
|
+
findRemoteFunc(item.list, funcList, tokenFuncList, blankList);
|
10
|
+
});
|
11
|
+
} else if (list[i].type == "table") {
|
12
|
+
// list[i].tabs.forEach(item => {
|
13
|
+
findRemoteFunc(list[i].list, funcList, tokenFuncList, blankList);
|
14
|
+
// })
|
15
|
+
} else {
|
16
|
+
if (list[i].type == "blank") {
|
17
|
+
if (list[i].model) {
|
18
|
+
blankList.push({
|
19
|
+
name: list[i].model,
|
20
|
+
label: list[i].name
|
21
|
+
});
|
22
|
+
}
|
23
|
+
} else if (list[i].type == "imgupload") {
|
24
|
+
if (list[i].options.tokenFunc) {
|
25
|
+
tokenFuncList.push({
|
26
|
+
func: list[i].options.tokenFunc,
|
27
|
+
label: list[i].name,
|
28
|
+
model: list[i].model
|
29
|
+
});
|
30
|
+
}
|
31
|
+
} else {
|
32
|
+
if (list[i].options.remote && list[i].options.remoteFunc) {
|
33
|
+
funcList.push({
|
34
|
+
func: list[i].options.remoteFunc,
|
35
|
+
label: list[i].name,
|
36
|
+
model: list[i].model
|
37
|
+
});
|
38
|
+
}
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
export default function(data, type = "vue") {
|
45
|
+
const funcList = [];
|
46
|
+
|
47
|
+
const tokenFuncList = [];
|
48
|
+
|
49
|
+
const blankList = [];
|
50
|
+
|
51
|
+
findRemoteFunc(JSON.parse(data).list, funcList, tokenFuncList, blankList);
|
52
|
+
|
53
|
+
let funcTemplate = "";
|
54
|
+
|
55
|
+
let blankTemplate = "";
|
56
|
+
|
57
|
+
for (let i = 0; i < funcList.length; i++) {
|
58
|
+
funcTemplate += `
|
59
|
+
${funcList[i].func} (resolve) {
|
60
|
+
// ${funcList[i].label} ${funcList[i].model}
|
61
|
+
// Call callback function once get the data from remote server
|
62
|
+
// resolve(data)
|
63
|
+
},
|
64
|
+
`;
|
65
|
+
}
|
66
|
+
|
67
|
+
for (let i = 0; i < tokenFuncList.length; i++) {
|
68
|
+
funcTemplate += `
|
69
|
+
${tokenFuncList[i].func} (resolve) {
|
70
|
+
// ${tokenFuncList[i].label} ${tokenFuncList[i].model}
|
71
|
+
// Call callback function once get the token
|
72
|
+
// resolve(token)
|
73
|
+
},
|
74
|
+
`;
|
75
|
+
}
|
76
|
+
|
77
|
+
for (let i = 0; i < blankList.length; i++) {
|
78
|
+
blankTemplate += `
|
79
|
+
<template slot="${blankList[i].name}" slot-scope="scope">
|
80
|
+
<!-- ${blankList[i].label} -->
|
81
|
+
<!-- use v-model="scope.model.${blankList[i].name}" to bind data -->
|
82
|
+
</template>
|
83
|
+
`;
|
84
|
+
}
|
85
|
+
|
86
|
+
if (type == "vue") {
|
87
|
+
return `
|
88
|
+
<template>
|
89
|
+
<div>
|
90
|
+
<fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
|
91
|
+
${blankTemplate}
|
92
|
+
</fm-generate-form>
|
93
|
+
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
94
|
+
</div>
|
95
|
+
</template>
|
96
|
+
|
97
|
+
<script>
|
98
|
+
export default {
|
99
|
+
data () {
|
100
|
+
return {
|
101
|
+
jsonData: ${data},
|
102
|
+
editData: {},
|
103
|
+
remoteFuncs: {
|
104
|
+
${funcTemplate}
|
105
|
+
}
|
106
|
+
}
|
107
|
+
},
|
108
|
+
methods: {
|
109
|
+
handleSubmit () {
|
110
|
+
this.$refs.generateForm.getData().then(data => {
|
111
|
+
// data check success
|
112
|
+
// data - form data
|
113
|
+
}).catch(e => {
|
114
|
+
// data check failed
|
115
|
+
})
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
</script>`;
|
120
|
+
} else {
|
121
|
+
return `<!DOCTYPE html>
|
122
|
+
<html>
|
123
|
+
<head>
|
124
|
+
<meta charset="UTF-8">
|
125
|
+
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
126
|
+
<link rel="stylesheet" href="https://unpkg.com/form-making/dist/FormMaking.css">
|
127
|
+
</head>
|
128
|
+
<body>
|
129
|
+
<div id="app">
|
130
|
+
<fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
|
131
|
+
${blankTemplate}
|
132
|
+
</fm-generate-form>
|
133
|
+
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
134
|
+
</div>
|
135
|
+
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
136
|
+
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
137
|
+
<script src="https://unpkg.com/form-making/dist/FormMaking.umd.js"></script>
|
138
|
+
<script>
|
139
|
+
new Vue({
|
140
|
+
el: '#app',
|
141
|
+
data: {
|
142
|
+
jsonData: ${data},
|
143
|
+
editData: {},
|
144
|
+
remoteFuncs: {
|
145
|
+
${funcTemplate}
|
146
|
+
}
|
147
|
+
},
|
148
|
+
methods: {
|
149
|
+
handleSubmit () {
|
150
|
+
this.$refs.generateForm.getData().then(data => {
|
151
|
+
// data check success
|
152
|
+
// data - form data
|
153
|
+
}).catch(e => {
|
154
|
+
// data check failed
|
155
|
+
})
|
156
|
+
}
|
157
|
+
}
|
158
|
+
})
|
159
|
+
</script>
|
160
|
+
</body>
|
161
|
+
</html>`;
|
162
|
+
}
|
163
|
+
}
|