-
Notifications
You must be signed in to change notification settings - Fork 2
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
1 parent
5de7c76
commit 1d7e926
Showing
2 changed files
with
63 additions
and
5 deletions.
There are no files selected for viewing
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,44 @@ | ||
<script setup lang="ts"> | ||
import { ref } from 'vue' | ||
import { object, string, InferType } from 'yup' | ||
const schema = object({ | ||
email: string().email('Invalid email').required('Required'), | ||
password: string() | ||
.min(8, 'Must be at least 8 characters') | ||
.required('Required') | ||
}) | ||
type Schema = InferType<typeof schema> | ||
const state = ref({ | ||
email: undefined, | ||
password: undefined | ||
}) | ||
async function submit (event) { | ||
// Do something with event.data | ||
console.log(event.data) | ||
} | ||
</script> | ||
|
||
<template> | ||
<s-form | ||
:schema="schema" | ||
:state="state" | ||
@submit="submit" | ||
class="space-y-4" | ||
> | ||
<s-form-group label="Email" name="email"> | ||
<s-input v-model="state.email" /> | ||
</s-form-group> | ||
|
||
<s-form-group label="Password" name="password"> | ||
<s-input v-model="state.password" type="password" /> | ||
</s-form-group> | ||
|
||
<s-button type="submit"> | ||
Submit | ||
</s-button> | ||
</s-form> | ||
</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