Skip to content

Commit

Permalink
docs(form): fix nested form example schema (#3135)
Browse files Browse the repository at this point in the history
  • Loading branch information
romhml authored Jan 20, 2025
1 parent b95b913 commit 088dc9b
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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">
Expand Down

0 comments on commit 088dc9b

Please sign in to comment.