refactor(Form): remove state assignment and opt-in to nested forms

This commit is contained in:
Romain Hamel
2025-04-16 18:10:54 +02:00
parent 4d875c03a2
commit 385cbeec6c
4 changed files with 89 additions and 16 deletions

View File

@@ -39,7 +39,7 @@ async function onSubmit(event: FormSubmitEvent<Schema>) {
<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">
<UForm v-if="state.news" :state="state" :schema="nestedSchema" nested>
<UFormField label="Email" name="email">
<UInput v-model="state.email" placeholder="john@lennon.com" />
</UFormField>