8000 :memo: update doc · vue-use-form/vue-use-form@a893400 · GitHub
[go: up one dir, main page]

Skip to content

Commit a893400

Browse files 10000
committed
📝 update doc
1 parent 737a258 commit a893400

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ npm i vue-use-form
2626

2727

2828
## Quick Start
29+
Try it on [playground](https://vue-use-form-play.netlify.app/#eNpVUcFugzAM/RUvl7ZSgTui1XaZtHOvuaTUtJnAZImphBD/PoeUrssp8Xt+79mZlO1c7znrjMu/Q0+qVJMmAP0AglYlLJVYuw+YDQGzpvddBLS6MbtQFsUrkrnWjDkht7YZc+PcP1RstIqCs6ZZ7dWHc7ngYlyF2lvHEJAHB62h60GrmOCoKaWBCUTmU1Rghsb3HWxepTeahEmMvjE1whe5gUNKLxRPpsMSAntLV/GO5LqnEFUjxePVBundL6+od2LD0jEBet/7APM+IjdDlxZPw7mzLIUZDmuoKjketztNVZGmkezyYOxkKYzygoea6P4JSxiAKnrCe1iUc+fxjsSyglfD7U7E40Lih1Q2+qU7QCnUdYbtZh14s1+/Lx6PP4P1eCnhSYDGYnuB2hD1DGcEicrjm+wytczil+6r63lg7gl4dCiWKe4zE8CjkLhFIi9gVcQB5VoVz32o+RclxNrU)
2930
```html
3031
<script setup lang="ts">
3132
import { useForm } from 'vue-use-form'
@@ -34,15 +35,25 @@ interface Inputs {
3435
username: string
3536
}
3637
37-
const { regsiter } = useForm<Inputs>()
38+
const {
39+
register,
40+
formState: { errors },
41+
handleSubmit,
42+
} = useForm<Inputs>()
3843
</script>
3944

4045
<template>
41-
<input
42-
:="register('username', {
43-
required: 'username field cannot be empty!'
44-
})"
45-
>
46+
errors: {{ errors }}
47+
<form @submit.prevent="handleSubmit()()">
48+
<input
49+
:="register('username', {
50+
required: 'username field cannot be empty!'
51+
})"
52+
>
53+
<button type="submit">
54+
submit
55+
</button>
56+
</form>
4657
</template>
4758
```
4859

0 commit comments

Comments
 (0)
0