fix: update vee-validate pin-input setValue
This commit is contained in:
parent
28924636bf
commit
c14f94629e
|
|
@ -23,7 +23,7 @@ const formSchema = toTypedSchema(z.object({
|
||||||
pin: z.array(z.coerce.string()).length(5, { message: 'Invalid input' }),
|
pin: z.array(z.coerce.string()).length(5, { message: 'Invalid input' }),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const { handleSubmit, setValues } = useForm({
|
const { handleSubmit, setFieldValue } = useForm({
|
||||||
validationSchema: formSchema,
|
validationSchema: formSchema,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
pin: ['1', '2', '3'],
|
pin: ['1', '2', '3'],
|
||||||
|
|
@ -56,9 +56,7 @@ const handleComplete = (e: string[]) => console.log(e.join(''))
|
||||||
:name="componentField.name"
|
:name="componentField.name"
|
||||||
@complete="handleComplete"
|
@complete="handleComplete"
|
||||||
@update:model-value="(arrStr) => {
|
@update:model-value="(arrStr) => {
|
||||||
setValues({
|
setFieldValue('pin', arrStr.filter(Boolean))
|
||||||
pin: arrStr.filter(Boolean),
|
|
||||||
})
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<PinInputGroup>
|
<PinInputGroup>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ const formSchema = toTypedSchema(z.object({
|
||||||
pin: z.array(z.coerce.string()).length(5, { message: 'Invalid input' }),
|
pin: z.array(z.coerce.string()).length(5, { message: 'Invalid input' }),
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const { handleSubmit, setValues } = useForm({
|
const { handleSubmit, setFieldValue } = useForm({
|
||||||
validationSchema: formSchema,
|
validationSchema: formSchema,
|
||||||
initialValues: {
|
initialValues: {
|
||||||
pin: ['1', '2', '3'],
|
pin: ['1', '2', '3'],
|
||||||
|
|
@ -56,9 +56,7 @@ const handleComplete = (e: string[]) => console.log(e.join(''))
|
||||||
:name="componentField.name"
|
:name="componentField.name"
|
||||||
@complete="handleComplete"
|
@complete="handleComplete"
|
||||||
@update:model-value="(arrStr) => {
|
@update:model-value="(arrStr) => {
|
||||||
setValues({
|
setFieldValue('pin', arrStr.filter(Boolean))
|
||||||
pin: arrStr.filter(Boolean),
|
|
||||||
})
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<PinInputGroup>
|
<PinInputGroup>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user