mirror of
https://github.com/keven1024/015.git
synced 2026-05-26 15:13:30 +00:00
refactor(front): update VeeForm component to utilize useForm for improved form handling and expose form state
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
<template>
|
||||
<Form as="" v-slot="slots">
|
||||
<slot v-bind="slots" />
|
||||
</Form>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { Form } from 'vee-validate'
|
||||
</script>
|
||||
import type { GenericObject } from 'vee-validate'
|
||||
import { useForm } from 'vee-validate'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
initialValues?: GenericObject
|
||||
keepValues?: boolean
|
||||
}>(), {
|
||||
initialValues: () => ({}),
|
||||
keepValues: false
|
||||
})
|
||||
const form = useForm({
|
||||
initialValues: props.initialValues,
|
||||
keepValuesOnUnmount: props.keepValues
|
||||
})
|
||||
defineExpose({
|
||||
form: form
|
||||
})
|
||||
|
||||
|
||||
</script>
|
||||
<template>
|
||||
<slot v-bind="form" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user