@gurso/vue-use-form
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Vue Use Form

Fields

example

html

<template>
    <input ref="refInput" />
<template>

js

import { useField, useFieldGroup } from "@gurso/vue-use-form"

const refInput = ref()
const { dirty, touched, valid, blank, model } = useField({ field: refInput })
// there also pristine, invalid, untouched

respectives CSS class are added to the element.

You can pass default value in argument:

const { dirty, touched, valid, blank, model } = useField({ field: refInput, value: "foo" })

if you use v-model on element, you should pass to:

html

<template>
    <input ref="refInput" v-model="foo" />
<template>

js

const model = ref("foo")
const refInput = ref()
const { dirty, touched, valid, blank } = useField({ field: refInput, model })

Readme

Keywords

none

Package Sidebar

Install

npm i @gurso/vue-use-form

Weekly Downloads

1

Version

0.1.0

License

none

Unpacked Size

6.4 kB

Total Files

4

Last publish

Collaborators

  • gurso