-
Notifications
You must be signed in to change notification settings - Fork 584
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
191 additions
and
35 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
docs/app/components/content/examples/button/ButtonLoadingAutoExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
async function onClick() { | ||
return new Promise<void>(res => setTimeout(res, 1000)) | ||
} | ||
</script> | ||
|
||
<template> | ||
<UButton loading-auto @click="onClick"> | ||
Button | ||
</UButton> | ||
</template> |
23 changes: 23 additions & 0 deletions
23
docs/app/components/content/examples/button/ButtonLoadingAutoFormExample.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<script setup lang="ts"> | ||
const state = reactive({ fullName: '' }) | ||
async function onSubmit() { | ||
return new Promise<void>(res => setTimeout(res, 1000)) | ||
} | ||
async function validate(data: Partial<typeof state>) { | ||
if (!data.fullName?.length) return [{ name: 'fullName', message: 'Required' }] | ||
return [] | ||
} | ||
</script> | ||
|
||
<template> | ||
<UForm :state="state" :validate="validate" @submit="onSubmit"> | ||
<UFormField name="fullName" label="Full name"> | ||
<UInput v-model="state.fullName" /> | ||
</UFormField> | ||
<UButton type="submit" class="mt-2" loading-auto> | ||
Submit | ||
</UButton> | ||
</UForm> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,8 @@ function onError(event: any) { | |
:state="state" | ||
:schema="schema" | ||
class="gap-4 flex flex-col w-60" | ||
@submit="(event) => onSubmit(event)" | ||
@error="(event) => onError(event)" | ||
@submit="onSubmit" | ||
@error="onError" | ||
> | ||
<UFormField label="Email" name="email"> | ||
<UInput v-model="state.email" placeholder="[email protected]" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,7 @@ function onSubmit(event: FormSubmitEvent<Schema>) { | |
:state="state" | ||
:schema="schema" | ||
class="gap-4 flex flex-col w-60" | ||
@submit="(event) => onSubmit(event)" | ||
@submit="onSubmit" | ||
> | ||
<UFormField label="Email" name="email"> | ||
<UInput v-model="state.email" placeholder="[email protected]" /> | ||
|
@@ -51,7 +51,7 @@ function onSubmit(event: FormSubmitEvent<Schema>) { | |
:schema="schema" | ||
class="gap-4 flex flex-col w-60" | ||
:validate-on-input-delay="2000" | ||
@submit="(event) => onSubmit(event)" | ||
@submit="onSubmit" | ||
> | ||
<UFormField label="Email" name="email"> | ||
<UInput v-model="state2.email" placeholder="[email protected]" /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.