1.0.3 • Published 8 months ago

@jeng3zeus/form-piw-piw v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Form piwx2 ⚡️ - Validate your nuxt with zod schema 🪿

npm version npm downloads License

Join with my pound with the 1st Library released Documentation 🐣

Install for nuxt3

npm i @jeng3zeus/form-piw-piw
// nuxt.config.ts
{
  modules: ['@jeng3zeus/form-piw-piw']
}

Features

  • Form to validate child element
  • Validate data with Zod
  • 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

<script>
import { z } from '#jengzeus/zod';

const schema = z.object({
    username: z.string().min(1, { message: 'กรุณากรอกชื่อของคุณ' })
});

const formData = reactive({
  username: ''
});
</script>

template

<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>
1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago