@jeng3zeus/form-piw-piw
Version:
Simply form validate for Nuxt3
77 lines (61 loc) • 2 kB
Markdown
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]
Join with my pound with the 1st Library released [Documentation][documents-href] 🐣
```bash
npm i @jeng3zeus/form-piw-piw
```
```ts
// nuxt.config.ts
{
modules: ['@jeng3zeus/form-piw-piw']
}
```
- Form to validate child element
- Validate data with [Zod][zod-href]
- Use Vue reactive for form data
- Validate with custom input using Vue provide
- Having a feature trigger with on blur validate (No focus)
## Example
script
```ts
<script>
import { z } from '#jengzeus/zod';
const schema = z.object({
username: z.string().min(1, { message: 'กรุณากรอกชื่อของคุณ' })
});
const formData = reactive({
username: ''
});
</script>
```
template
```vue
<JForm
v-slot="{ errors }"
name="login"
:form="formData"
:schema="schema"
@submit="handleSubmit"
@reset="handleReset"
>
<input
v-model="formData.username"
name="username"
placeholder="username"
/>
<p style="color: red;">{{ errors.username }}</p>
</JForm>
```
<!-- Badges -->
[]: https://img.shields.io/npm/v/@jeng3zeus/form-piw-piw/latest.svg?style=flat&colorA=020420&colorB=00DC82
[]: https://www.npmjs.com/package/@jeng3zeus/form-piw-piw
[]: https://img.shields.io/npm/dm/@jeng3zeus/form-piw-piw.svg?style=flat&colorA=020420&colorB=00DC82
[]: https://www.npmjs.com/package/@jeng3zeus/form-piw-piw
[]: https://img.shields.io/github/license/JENGZY-devBoi/jengzeus-form-piw-piw.svg?style=flat&colorA=020420&colorB=00DC82
[]: https://github.com/JENGZY-devBoi/jengzeus-form-piw-piw/blob/main/LICENSE
[]: https://jengzeus-form-piw-piw-documentation.vercel.app/
[]: https://zod.dev/