tianheng-ui 0.0.47 → 0.0.48
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 +1 -1
- package/lib/tianheng-ui.js +3 -3
- package/package.json +1 -1
- package/packages/formMaking/Container.vue +590 -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 +200 -18
- package/packages/formMaking/Upload/index.vue +572 -572
- package/packages/formMaking/WidgetConfig.vue +187 -13
- package/packages/formMaking/WidgetForm.vue +134 -268
- package/packages/formMaking/WidgetFormItem.vue +369 -29
- package/packages/formMaking/componentsConfig.js +129 -13
- package/packages/formMaking/generateCode.js +154 -154
- 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
@@ -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,6 +312,8 @@ export const basicComponents = [
|
|
288
312
|
type: "text",
|
289
313
|
icon: "icon-wenzishezhi-",
|
290
314
|
options: {
|
315
|
+
labelWidth: 100,
|
316
|
+
isLabelWidth: false,
|
291
317
|
defaultValue: "This is a text",
|
292
318
|
customClass: ""
|
293
319
|
}
|
@@ -304,16 +330,18 @@ export const advanceComponents = [
|
|
304
330
|
}
|
305
331
|
},
|
306
332
|
{
|
307
|
-
name: "
|
333
|
+
name: "文件",
|
308
334
|
type: "imgupload",
|
309
335
|
icon: "icon-tupian",
|
310
336
|
options: {
|
337
|
+
width: "",
|
338
|
+
labelWidth: 100,
|
339
|
+
isLabelWidth: false,
|
311
340
|
defaultValue: [],
|
312
341
|
size: {
|
313
342
|
width: 100,
|
314
343
|
height: 100
|
315
344
|
},
|
316
|
-
width: "",
|
317
345
|
tokenFunc: "funcGetToken",
|
318
346
|
token: "",
|
319
347
|
domain: "https://tcdn.form.making.link/",
|
@@ -340,9 +368,11 @@ export const advanceComponents = [
|
|
340
368
|
type: "editor",
|
341
369
|
icon: "icon-fuwenbenkuang",
|
342
370
|
options: {
|
343
|
-
defaultValue: "",
|
344
371
|
width: "",
|
345
372
|
height: "",
|
373
|
+
labelWidth: 100,
|
374
|
+
isLabelWidth: false,
|
375
|
+
defaultValue: "",
|
346
376
|
disabled: false,
|
347
377
|
required: false
|
348
378
|
}
|
@@ -352,8 +382,10 @@ export const advanceComponents = [
|
|
352
382
|
type: "cascader",
|
353
383
|
icon: "icon-jilianxuanze",
|
354
384
|
options: {
|
355
|
-
defaultValue: [],
|
356
385
|
width: "",
|
386
|
+
labelWidth: 100,
|
387
|
+
isLabelWidth: false,
|
388
|
+
defaultValue: [],
|
357
389
|
placeholder: "",
|
358
390
|
disabled: false,
|
359
391
|
clearable: false,
|
@@ -375,6 +407,38 @@ export const advanceComponents = [
|
|
375
407
|
},
|
376
408
|
remoteFunc: ""
|
377
409
|
}
|
410
|
+
},
|
411
|
+
{
|
412
|
+
name: "子表单",
|
413
|
+
type: "table",
|
414
|
+
icon: "icon-table",
|
415
|
+
options: {
|
416
|
+
defaultValue: [],
|
417
|
+
customClass: "",
|
418
|
+
labelWidth: 100,
|
419
|
+
isLabelWidth: false,
|
420
|
+
hideLabel: false,
|
421
|
+
hidden: false,
|
422
|
+
dataBind: true,
|
423
|
+
disabled: false,
|
424
|
+
required: false,
|
425
|
+
validatorCheck: false,
|
426
|
+
validator: "",
|
427
|
+
paging: false,
|
428
|
+
pageSize: 5,
|
429
|
+
isAdd: true,
|
430
|
+
isDelete: true,
|
431
|
+
isSerial: true,
|
432
|
+
remoteFunc: "",
|
433
|
+
remoteOption: "",
|
434
|
+
tableColumn: false
|
435
|
+
},
|
436
|
+
events: {
|
437
|
+
onChange: "",
|
438
|
+
onRowAdd: "",
|
439
|
+
onRowRemove: ""
|
440
|
+
},
|
441
|
+
list: []
|
378
442
|
}
|
379
443
|
];
|
380
444
|
|
@@ -396,7 +460,59 @@ export const layoutComponents = [
|
|
396
460
|
options: {
|
397
461
|
gutter: 0,
|
398
462
|
justify: "start",
|
399
|
-
align: "top"
|
463
|
+
align: "top",
|
464
|
+
// labelWidth: 100,
|
465
|
+
// isLabelWidth: false,
|
466
|
+
hideLabel: true
|
400
467
|
}
|
468
|
+
},
|
469
|
+
{
|
470
|
+
type: "tabs",
|
471
|
+
icon: "icon-tabs",
|
472
|
+
tabs: [
|
473
|
+
{
|
474
|
+
label: "选项1",
|
475
|
+
value: "tab_1",
|
476
|
+
list: []
|
477
|
+
},
|
478
|
+
{
|
479
|
+
label: "选项2",
|
480
|
+
value: "tab_2",
|
481
|
+
list: []
|
482
|
+
}
|
483
|
+
],
|
484
|
+
options: {
|
485
|
+
defaultValue: "tab_1",
|
486
|
+
type: "",
|
487
|
+
tabPosition: "top",
|
488
|
+
customClass: "",
|
489
|
+
hidden: false,
|
490
|
+
labelWidth: 100,
|
491
|
+
isLabelWidth: false,
|
492
|
+
hideLabel: true,
|
493
|
+
remote: false,
|
494
|
+
remoteFunc: "",
|
495
|
+
remoteOption: "",
|
496
|
+
tableColumn: false
|
497
|
+
},
|
498
|
+
name: "标签页",
|
499
|
+
rules: []
|
500
|
+
},
|
501
|
+
{
|
502
|
+
name: "分割线",
|
503
|
+
type: "divider",
|
504
|
+
icon: "icon-fengexian",
|
505
|
+
options: {
|
506
|
+
height: 50,
|
507
|
+
hidden: false,
|
508
|
+
labelWidth: 100,
|
509
|
+
isLabelWidth: false,
|
510
|
+
hideLabel: true,
|
511
|
+
contentPosition: "left",
|
512
|
+
remoteFunc: "",
|
513
|
+
remoteOption: "",
|
514
|
+
tableColumn: false
|
515
|
+
},
|
516
|
+
rules: []
|
401
517
|
}
|
402
518
|
];
|
@@ -1,155 +1,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 {
|
8
|
-
if (list[i].type == 'blank') {
|
9
|
-
if (list[i].model) {
|
10
|
-
blankList.push({
|
11
|
-
name: list[i].model,
|
12
|
-
label: list[i].name
|
13
|
-
})
|
14
|
-
}
|
15
|
-
} else if (list[i].type == 'imgupload') {
|
16
|
-
if (list[i].options.tokenFunc) {
|
17
|
-
tokenFuncList.push({
|
18
|
-
func: list[i].options.tokenFunc,
|
19
|
-
label: list[i].name,
|
20
|
-
model: list[i].model
|
21
|
-
})
|
22
|
-
}
|
23
|
-
} else {
|
24
|
-
if (list[i].options.remote && list[i].options.remoteFunc) {
|
25
|
-
funcList.push({
|
26
|
-
func: list[i].options.remoteFunc,
|
27
|
-
label: list[i].name,
|
28
|
-
model: list[i].model
|
29
|
-
})
|
30
|
-
}
|
31
|
-
}
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
export default function (data, type = 'vue') {
|
37
|
-
|
38
|
-
const funcList = []
|
39
|
-
|
40
|
-
const tokenFuncList = []
|
41
|
-
|
42
|
-
const blankList = []
|
43
|
-
|
44
|
-
findRemoteFunc(JSON.parse(data).list, funcList, tokenFuncList, blankList)
|
45
|
-
|
46
|
-
let funcTemplate = ''
|
47
|
-
|
48
|
-
let blankTemplate = ''
|
49
|
-
|
50
|
-
for(let i = 0; i < funcList.length; i++) {
|
51
|
-
funcTemplate += `
|
52
|
-
${funcList[i].func} (resolve) {
|
53
|
-
// ${funcList[i].label} ${funcList[i].model}
|
54
|
-
// Call callback function once get the data from remote server
|
55
|
-
// resolve(data)
|
56
|
-
},
|
57
|
-
`
|
58
|
-
}
|
59
|
-
|
60
|
-
for(let i = 0; i < tokenFuncList.length; i++) {
|
61
|
-
funcTemplate += `
|
62
|
-
${tokenFuncList[i].func} (resolve) {
|
63
|
-
// ${tokenFuncList[i].label} ${tokenFuncList[i].model}
|
64
|
-
// Call callback function once get the token
|
65
|
-
// resolve(token)
|
66
|
-
},
|
67
|
-
`
|
68
|
-
}
|
69
|
-
|
70
|
-
for (let i = 0; i < blankList.length; i++) {
|
71
|
-
blankTemplate += `
|
72
|
-
<template slot="${blankList[i].name}" slot-scope="scope">
|
73
|
-
<!-- ${blankList[i].label} -->
|
74
|
-
<!-- use v-model="scope.model.${blankList[i].name}" to bind data -->
|
75
|
-
</template>
|
76
|
-
`
|
77
|
-
}
|
78
|
-
|
79
|
-
if (type == 'vue') {
|
80
|
-
return `<template>
|
81
|
-
<div>
|
82
|
-
<fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
|
83
|
-
${blankTemplate}
|
84
|
-
</fm-generate-form>
|
85
|
-
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
86
|
-
</div>
|
87
|
-
</template>
|
88
|
-
|
89
|
-
<script>
|
90
|
-
export default {
|
91
|
-
data () {
|
92
|
-
return {
|
93
|
-
jsonData: ${data},
|
94
|
-
editData: {},
|
95
|
-
remoteFuncs: {
|
96
|
-
${funcTemplate}
|
97
|
-
}
|
98
|
-
}
|
99
|
-
},
|
100
|
-
methods: {
|
101
|
-
handleSubmit () {
|
102
|
-
this.$refs.generateForm.getData().then(data => {
|
103
|
-
// data check success
|
104
|
-
// data - form data
|
105
|
-
}).catch(e => {
|
106
|
-
// data check failed
|
107
|
-
})
|
108
|
-
}
|
109
|
-
}
|
110
|
-
}
|
111
|
-
</script>`
|
112
|
-
} else {
|
113
|
-
return `<!DOCTYPE html>
|
114
|
-
<html>
|
115
|
-
<head>
|
116
|
-
<meta charset="UTF-8">
|
117
|
-
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
118
|
-
<link rel="stylesheet" href="https://unpkg.com/form-making/dist/FormMaking.css">
|
119
|
-
</head>
|
120
|
-
<body>
|
121
|
-
<div id="app">
|
122
|
-
<fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
|
123
|
-
${blankTemplate}
|
124
|
-
</fm-generate-form>
|
125
|
-
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
126
|
-
</div>
|
127
|
-
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
128
|
-
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
129
|
-
<script src="https://unpkg.com/form-making/dist/FormMaking.umd.js"></script>
|
130
|
-
<script>
|
131
|
-
new Vue({
|
132
|
-
el: '#app',
|
133
|
-
data: {
|
134
|
-
jsonData: ${data},
|
135
|
-
editData: {},
|
136
|
-
remoteFuncs: {
|
137
|
-
${funcTemplate}
|
138
|
-
}
|
139
|
-
},
|
140
|
-
methods: {
|
141
|
-
handleSubmit () {
|
142
|
-
this.$refs.generateForm.getData().then(data => {
|
143
|
-
// data check success
|
144
|
-
// data - form data
|
145
|
-
}).catch(e => {
|
146
|
-
// data check failed
|
147
|
-
})
|
148
|
-
}
|
149
|
-
}
|
150
|
-
})
|
151
|
-
</script>
|
152
|
-
</body>
|
153
|
-
</html>`
|
154
|
-
}
|
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 {
|
8
|
+
if (list[i].type == 'blank') {
|
9
|
+
if (list[i].model) {
|
10
|
+
blankList.push({
|
11
|
+
name: list[i].model,
|
12
|
+
label: list[i].name
|
13
|
+
})
|
14
|
+
}
|
15
|
+
} else if (list[i].type == 'imgupload') {
|
16
|
+
if (list[i].options.tokenFunc) {
|
17
|
+
tokenFuncList.push({
|
18
|
+
func: list[i].options.tokenFunc,
|
19
|
+
label: list[i].name,
|
20
|
+
model: list[i].model
|
21
|
+
})
|
22
|
+
}
|
23
|
+
} else {
|
24
|
+
if (list[i].options.remote && list[i].options.remoteFunc) {
|
25
|
+
funcList.push({
|
26
|
+
func: list[i].options.remoteFunc,
|
27
|
+
label: list[i].name,
|
28
|
+
model: list[i].model
|
29
|
+
})
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
export default function (data, type = 'vue') {
|
37
|
+
|
38
|
+
const funcList = []
|
39
|
+
|
40
|
+
const tokenFuncList = []
|
41
|
+
|
42
|
+
const blankList = []
|
43
|
+
|
44
|
+
findRemoteFunc(JSON.parse(data).list, funcList, tokenFuncList, blankList)
|
45
|
+
|
46
|
+
let funcTemplate = ''
|
47
|
+
|
48
|
+
let blankTemplate = ''
|
49
|
+
|
50
|
+
for(let i = 0; i < funcList.length; i++) {
|
51
|
+
funcTemplate += `
|
52
|
+
${funcList[i].func} (resolve) {
|
53
|
+
// ${funcList[i].label} ${funcList[i].model}
|
54
|
+
// Call callback function once get the data from remote server
|
55
|
+
// resolve(data)
|
56
|
+
},
|
57
|
+
`
|
58
|
+
}
|
59
|
+
|
60
|
+
for(let i = 0; i < tokenFuncList.length; i++) {
|
61
|
+
funcTemplate += `
|
62
|
+
${tokenFuncList[i].func} (resolve) {
|
63
|
+
// ${tokenFuncList[i].label} ${tokenFuncList[i].model}
|
64
|
+
// Call callback function once get the token
|
65
|
+
// resolve(token)
|
66
|
+
},
|
67
|
+
`
|
68
|
+
}
|
69
|
+
|
70
|
+
for (let i = 0; i < blankList.length; i++) {
|
71
|
+
blankTemplate += `
|
72
|
+
<template slot="${blankList[i].name}" slot-scope="scope">
|
73
|
+
<!-- ${blankList[i].label} -->
|
74
|
+
<!-- use v-model="scope.model.${blankList[i].name}" to bind data -->
|
75
|
+
</template>
|
76
|
+
`
|
77
|
+
}
|
78
|
+
|
79
|
+
if (type == 'vue') {
|
80
|
+
return `<template>
|
81
|
+
<div>
|
82
|
+
<fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
|
83
|
+
${blankTemplate}
|
84
|
+
</fm-generate-form>
|
85
|
+
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
86
|
+
</div>
|
87
|
+
</template>
|
88
|
+
|
89
|
+
<script>
|
90
|
+
export default {
|
91
|
+
data () {
|
92
|
+
return {
|
93
|
+
jsonData: ${data},
|
94
|
+
editData: {},
|
95
|
+
remoteFuncs: {
|
96
|
+
${funcTemplate}
|
97
|
+
}
|
98
|
+
}
|
99
|
+
},
|
100
|
+
methods: {
|
101
|
+
handleSubmit () {
|
102
|
+
this.$refs.generateForm.getData().then(data => {
|
103
|
+
// data check success
|
104
|
+
// data - form data
|
105
|
+
}).catch(e => {
|
106
|
+
// data check failed
|
107
|
+
})
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
</script>`
|
112
|
+
} else {
|
113
|
+
return `<!DOCTYPE html>
|
114
|
+
<html>
|
115
|
+
<head>
|
116
|
+
<meta charset="UTF-8">
|
117
|
+
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
|
118
|
+
<link rel="stylesheet" href="https://unpkg.com/form-making/dist/FormMaking.css">
|
119
|
+
</head>
|
120
|
+
<body>
|
121
|
+
<div id="app">
|
122
|
+
<fm-generate-form :data="jsonData" :remote="remoteFuncs" :value="editData" ref="generateForm">
|
123
|
+
${blankTemplate}
|
124
|
+
</fm-generate-form>
|
125
|
+
<el-button type="primary" @click="handleSubmit">提交</el-button>
|
126
|
+
</div>
|
127
|
+
<script src="https://unpkg.com/vue/dist/vue.js"></script>
|
128
|
+
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
129
|
+
<script src="https://unpkg.com/form-making/dist/FormMaking.umd.js"></script>
|
130
|
+
<script>
|
131
|
+
new Vue({
|
132
|
+
el: '#app',
|
133
|
+
data: {
|
134
|
+
jsonData: ${data},
|
135
|
+
editData: {},
|
136
|
+
remoteFuncs: {
|
137
|
+
${funcTemplate}
|
138
|
+
}
|
139
|
+
},
|
140
|
+
methods: {
|
141
|
+
handleSubmit () {
|
142
|
+
this.$refs.generateForm.getData().then(data => {
|
143
|
+
// data check success
|
144
|
+
// data - form data
|
145
|
+
}).catch(e => {
|
146
|
+
// data check failed
|
147
|
+
})
|
148
|
+
}
|
149
|
+
}
|
150
|
+
})
|
151
|
+
</script>
|
152
|
+
</body>
|
153
|
+
</html>`
|
154
|
+
}
|
155
155
|
}
|