Subscription-based form state management for Vue.js
    
🏁 High performance subscription-based form state management for Vue.js.
``bash`
yarn add final-form vue-final-form

This library exports two components:
`js`
import { FinalForm, FinalField } from "vue-final-form";
The first component you'll need is the FinalForm component:
`vue`
The only required prop is submit, it defines how to submit the form data, maybe simply log it:
`js`
function submit(values) {
console.log(values);
}
The rendered output is:
`html`
As you can see it does nothing for now, you need to feed it a
Things got a bit more complex, but it's easy if you try to understand:
The only prop that is required by
FinalField is name, it tells the field where to store the field data in the form state, here we stores it as state.username.The
validate prop is used to validate the field data, it could be a function that returns an error message or null, undefined when it's considered valid.The data that
FinalField passed to its children contains props.events which is required to be bound with the input element in order to properly track events. And props.name is the name you gave FinalField, props.meta is some infomation about this field.API
$3
#### Props
##### submit
Type:
function
Default: () => {}Here we allow
submit to be optional since you may not need it when you just use vue-final-form as a form validation tool.See onSubmit.
##### validate
Type:
function ArrayA whole-record validation function that takes all the values of the form and returns any validation errors.
See validate.
##### initialValues
Type:
objectSee initialValues.
##### subscription
Type:
FormSubscription
Default: AllSee FormSubscription.
#### Events
##### change
Params:
-
formState: https://github.com/final-form/final-form#formstate#### Scoped slot props
It basically exposes everything in FormState plus follwoings:
##### handleSubmit
Type:
functionThe function that you will invoke to submit the form data, you may use it as the
:submit event handler on your .##### reset
Type:
functionSee FormApi.reset.
##### mutators
Type:
?{ [string]: Function }See FormApi.mutators.
##### batch
Type:
functionSee FormApi.batch.
##### blur
Type:
functionSee FormApi.blur.
##### change
Type:
functionSee FormApi.change.
##### focus
Type:
functionSee FormApi.focus
##### initialize
Type:
functionSee FormApi.initialize.
$3
#### Props
##### name
Type:
string
Required: trueThe name of this field.
See name.
##### validate
Type:
function ArrayA field-level validation function to validate a single field value. Returns an error if the value is not valid, or undefined if the value is valid.
See validate.
##### subscription
Type:
FieldSubscription
Default: AllSee FieldSubcription.
#### Events
##### change
Params:
-
fieldState: https://github.com/final-form/final-form#fieldstate#### Scoped slot props
It basically exposes FieldState.
##### name
Type:
stringThe name of this field.
FieldState.name##### change
Type:
functionFieldState.change##### value
Type:
any.The current value of this field. You should probably bind it to
:value of input or textarea if you have set initial value for the field.##### events
Type:
{ input: Function, focus: Function, blur: Function }Bind these event handlers to your
input textarea element.See FieldState.change, FieldState.focus, FieldState.blur.
##### meta
Type:
objectEverything in FieldState except for
blur change focus nameContributing
1. Fork it!
2. Create your feature branch:
git checkout -b my-new-feature
3. Commit your changes: git commit -am 'Add some feature'
4. Push to the branch: git push origin my-new-feature`vue-final-form © EGOIST, Released under the MIT License.
Authored and maintained by EGOIST with help from contributors (list).
> egoist.moe · GitHub @EGOIST · Twitter @\_egoistlily