refactor: simplify validation for Command component
This commit is contained in:
parent
9881d9d1ec
commit
157b1f00df
|
|
@ -77,11 +77,7 @@ async function onSubmit(values: any) {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Separator />
|
<Separator />
|
||||||
<Form
|
<Form :validation-schema="accountFormSchema" class="space-y-8" @submit="onSubmit">
|
||||||
v-slot="{
|
|
||||||
setValues,
|
|
||||||
}" :validation-schema="accountFormSchema" class="space-y-8" @submit="onSubmit"
|
|
||||||
>
|
|
||||||
<FormField v-slot="{ componentField }" name="name">
|
<FormField v-slot="{ componentField }" name="name">
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Name</FormLabel>
|
<FormLabel>Name</FormLabel>
|
||||||
|
|
@ -123,7 +119,7 @@ async function onSubmit(values: any) {
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</FormField>
|
</FormField>
|
||||||
|
|
||||||
<FormField v-slot="{ value }" name="language">
|
<FormField v-slot="{ value, componentField }" name="language">
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Language</FormLabel>
|
<FormLabel>Language</FormLabel>
|
||||||
|
|
||||||
|
|
@ -145,13 +141,12 @@ async function onSubmit(values: any) {
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</PopoverTrigger>
|
</PopoverTrigger>
|
||||||
<PopoverContent class="w-[200px] p-0">
|
<PopoverContent class="w-[200px] p-0">
|
||||||
<Command>
|
<Command v-bind="componentField">
|
||||||
<CommandInput placeholder="Search language..." />
|
<CommandInput placeholder="Search language..." />
|
||||||
<CommandEmpty>No framework found.</CommandEmpty>
|
<CommandEmpty>No framework found.</CommandEmpty>
|
||||||
<CommandGroup>
|
<CommandGroup>
|
||||||
<CommandItem
|
<CommandItem
|
||||||
v-for="language in languages" :key="language.value" :value="language.value" @select="(val) => {
|
v-for="language in languages" :key="language.value" :value="language.value" @select="() => {
|
||||||
setValues({ language: val })
|
|
||||||
open = false
|
open = false
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user