docs(form): fix nested form example schema (#3135)

This commit is contained in:
Romain Hamel
2025-01-20 11:53:05 +01:00
committed by GitHub
parent b95b91391a
commit 088dc9bf38

View File

@@ -4,7 +4,7 @@ import type { FormSubmitEvent } from '@nuxt/ui'
const schema = z.object({
name: z.string().min(2),
news: z.boolean()
news: z.boolean().default(false)
})
type Schema = z.output<typeof schema>
@@ -36,7 +36,7 @@ async function onSubmit(event: FormSubmitEvent<any>) {
</UFormField>
<div>
<UCheckbox v-model="state.news" name="news" label="Register to our newsletter" />
<UCheckbox v-model="state.news" name="news" label="Register to our newsletter" @update:model-value="state.email = undefined" />
</div>
<UForm v-if="state.news" :state="state" :schema="nestedSchema">