fix: update vee-validate pin-input setValue

This commit is contained in:
romanhrynevych 2024-05-10 09:56:30 +03:00
parent 28924636bf
commit c14f94629e
2 changed files with 4 additions and 8 deletions

View File

@ -23,7 +23,7 @@ const formSchema = toTypedSchema(z.object({
pin: z.array(z.coerce.string()).length(5, { message: 'Invalid input' }),
}))
const { handleSubmit, setValues } = useForm({
const { handleSubmit, setFieldValue } = useForm({
validationSchema: formSchema,
initialValues: {
pin: ['1', '2', '3'],
@ -56,9 +56,7 @@ const handleComplete = (e: string[]) => console.log(e.join(''))
:name="componentField.name"
@complete="handleComplete"
@update:model-value="(arrStr) => {
setValues({
pin: arrStr.filter(Boolean),
})
setFieldValue('pin', arrStr.filter(Boolean))
}"
>
<PinInputGroup>

View File

@ -23,7 +23,7 @@ const formSchema = toTypedSchema(z.object({
pin: z.array(z.coerce.string()).length(5, { message: 'Invalid input' }),
}))
const { handleSubmit, setValues } = useForm({
const { handleSubmit, setFieldValue } = useForm({
validationSchema: formSchema,
initialValues: {
pin: ['1', '2', '3'],
@ -56,9 +56,7 @@ const handleComplete = (e: string[]) => console.log(e.join(''))
:name="componentField.name"
@complete="handleComplete"
@update:model-value="(arrStr) => {
setValues({
pin: arrStr.filter(Boolean),
})
setFieldValue('pin', arrStr.filter(Boolean))
}"
>
<PinInputGroup>