feat: add reactivity to formkit
This commit is contained in:
@@ -13,8 +13,9 @@
|
|||||||
@submit="handleSubmit"
|
@submit="handleSubmit"
|
||||||
:submit-label="submitLabel"
|
:submit-label="submitLabel"
|
||||||
outer-class="tw:space-y-4"
|
outer-class="tw:space-y-4"
|
||||||
|
v-model="form"
|
||||||
>
|
>
|
||||||
<FormKitSchema :schema="schema" />
|
<FormKitSchema :schema="schema" :data="data"/>
|
||||||
</FormKit>
|
</FormKit>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,6 +25,10 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { FormKit, FormKitSchema } from '@formkit/vue';
|
import { FormKit, FormKitSchema } from '@formkit/vue';
|
||||||
|
import {reactive, ref} from "vue";
|
||||||
|
|
||||||
|
const form = ref({});
|
||||||
|
const data = reactive(form);
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
schema: {
|
schema: {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
:actions="false"
|
:actions="false"
|
||||||
@submit="onFormSubmit"
|
@submit="onFormSubmit"
|
||||||
>
|
>
|
||||||
<FormKitSchema :schema="checkoutFormSchema"/>
|
<FormKitSchema :schema="checkoutFormSchema" :data="data"/>
|
||||||
</FormKit>
|
</FormKit>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -76,6 +76,9 @@ const btnText = computed(() => {
|
|||||||
return checkout.isLoading ? 'Подождите...' : 'Создать заказ';
|
return checkout.isLoading ? 'Подождите...' : 'Создать заказ';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
import { reactive } from 'vue';
|
||||||
|
const data = reactive(checkout.form);
|
||||||
|
|
||||||
function onCreateBtnClick() {
|
function onCreateBtnClick() {
|
||||||
try {
|
try {
|
||||||
submitForm('form-checkout');
|
submitForm('form-checkout');
|
||||||
|
|||||||
Reference in New Issue
Block a user