@@ -30,15 +30,15 @@ const formData = reactive(props.data)
30
30
const data = ref ({})
31
31
32
32
async function submitHandler() {
33
- showMessage (' success' , ' Form Submitted ' , ' Input creation completed successfully ...' )
33
+ showMessage (' success' , ` Form Input (${ formData . _dollar_formkit }) updated ` , ' Input creation completed successfully ...' )
34
34
35
35
data .value = { }
36
36
schemaResultFormKey .value += 1
37
37
Object .assign (formData , { ... formData , schemaResultFormKey: schemaResultFormKey .value })
38
38
}
39
39
40
40
async function submitHandler2() {
41
-
41
+ showMessage ( ' success ' , ` Data submitted ` , data . value )
42
42
}
43
43
44
44
const schemaResult = computed (() => editorDataToSchema (formData ))
@@ -61,8 +61,8 @@ function copyObject() {
61
61
{{ header }}
62
62
</h2 >
63
63
<slot />
64
- <div class =" flex flex-wrap gap-8" >
65
- <div class =" min- w-40rem basis-1/2 md:basis-1/3" >
64
+ <div class =" grid grid-cols-1 xl:grid-cols-2 gap-8" >
65
+ <div class =" w-40rem basis-1/2 md:basis-1/3" mb-4 >
66
66
<h3 >Create Formkit Input</h3 >
67
67
<FormKit
68
68
v-model =" formData"
@@ -77,28 +77,29 @@ function copyObject() {
77
77
</FormKit >
78
78
<pre v-if =" false" >{{ formSchema }}</pre >
79
79
</div >
80
- <div class = " " >
80
+ <div >
81
81
<h3 >Generated Formkit Input Preview</h3 >
82
82
<div class =" mb-4" >
83
83
Some changes require to trigger the update of generated input
84
84
</div >
85
85
<div :key =" schemaResultFormKey" >
86
- <FormKit
87
- v-model =" data"
88
- type =" form"
89
- :submit-attrs =" {
90
- inputClass: 'p-button p-component',
91
- }"
92
- @submit =" submitHandler2"
93
- >
94
- <FormKitSchema :schema =" schemaResult" :data =" data" />
95
- </FormKit >
96
- <div class =" mt-4 mb-4" >
97
- <h3 >Copy Schema to Clipboard - Supported: {{ isSupported }}</h3 >
98
- <Button label =" Copy as JSON" class =" mr-4" @click =" copyJson" /><Button label =" Copy as Object" @click =" copyObject" />
86
+ <div class =" max-w-100" >
87
+ <FormKit
88
+ v-model =" data"
89
+ type =" form"
90
+ :submit-attrs =" {
91
+ inputClass: 'p-button p-component',
92
+ }"
93
+ @submit =" submitHandler2"
94
+ >
95
+ <FormKitSchema :schema =" schemaResult" :data =" data" />
96
+ </FormKit >
99
97
</div >
100
98
<h3 >Generated Formkit Schema</h3 >
101
99
<pre >{{ schemaResult }}</pre >
100
+ <Button v-if =" isSupported" label =" Copy as JSON" class =" mr-4" @click =" copyJson" />
101
+ <Button v-if =" isSupported" label =" Copy as Object" @click =" copyObject" />
102
+
102
103
<h3 >Generated Formkit Data</h3 >
103
104
<pre >{{ data }}</pre >
104
105
</div >
0 commit comments