notform 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -7
- package/dist/index.d.ts +268 -255
- package/dist/index.js +578 -523
- package/package.json +27 -25
package/README.md
CHANGED
|
@@ -33,33 +33,48 @@ Each form consists of:
|
|
|
33
33
|
|
|
34
34
|
```vue
|
|
35
35
|
<script setup lang="ts">
|
|
36
|
+
import { NotField, NotForm, NotMessage, useNotForm } from 'notform'
|
|
36
37
|
import { z } from 'zod'
|
|
37
|
-
import { useNotForm, NotForm, NotField, NotMessage } from 'notform'
|
|
38
38
|
|
|
39
39
|
const schema = z.object({
|
|
40
|
-
name: z.string().min(1, 'Name is required'),
|
|
41
40
|
email: z.string().email('Invalid email'),
|
|
41
|
+
name: z.string().min(1, 'Name is required'),
|
|
42
42
|
})
|
|
43
43
|
|
|
44
44
|
const form = useNotForm({
|
|
45
|
-
schema,
|
|
46
45
|
onSubmit: (values) => {
|
|
47
46
|
console.log('Form submitted:', values)
|
|
48
47
|
},
|
|
48
|
+
schema,
|
|
49
49
|
})
|
|
50
50
|
</script>
|
|
51
51
|
|
|
52
52
|
<template>
|
|
53
|
-
<NotForm
|
|
53
|
+
<NotForm
|
|
54
|
+
:form="form"
|
|
55
|
+
@submit="form.submit"
|
|
56
|
+
>
|
|
54
57
|
<NotField path="name">
|
|
55
|
-
<input
|
|
58
|
+
<input
|
|
59
|
+
v-model="form.values.name"
|
|
60
|
+
type="text"
|
|
61
|
+
>
|
|
62
|
+
|
|
56
63
|
<NotMessage path="name" />
|
|
57
64
|
</NotField>
|
|
65
|
+
|
|
58
66
|
<NotField path="email">
|
|
59
|
-
<input
|
|
67
|
+
<input
|
|
68
|
+
v-model="form.values.email"
|
|
69
|
+
type="email"
|
|
70
|
+
>
|
|
71
|
+
|
|
60
72
|
<NotMessage path="email" />
|
|
61
73
|
</NotField>
|
|
62
|
-
|
|
74
|
+
|
|
75
|
+
<button type="submit">
|
|
76
|
+
Submit
|
|
77
|
+
</button>
|
|
63
78
|
</NotForm>
|
|
64
79
|
</template>
|
|
65
80
|
```
|