Vue Form Validation with Composition API
Vue Form Validation with Composition API
npm install @vorms/coreIt will be exposed to global as window.Vorms
setup script
import { useForm } from '@vorms/core'
const sugarOptions = ['no', 'light', 'half', 'standard']
const { register, handleSubmit, handleReset } = useForm({
initialValues: {
drink: '',
sugar: 'light',
},
onSubmit(data) {
console.log(data)
}
})
const { value: drink, attrs: drinkFieldAttrs } = register('drink')
const { value: sugar, attrs: sugarFieldAttrs } = register('sugar')template
Drink
Sugar level
{{ item }}
Reset
Submit
Refer documentations for more details.
This project is heavily inspired by the following awesome projects.
Thanks to the wonderful people who have already contributed to Vorms!
Made with contrib.rocks.
MIT License © 2022-PRESENT Alex Liu
No open issues yet, or sync has not completed.