photo by @amjohnphilip

v-model Directive

VueJs provides the v-model directive that binds the user input values and selects with the vue data objects.

Event Modifiers

The.lazy event modifier will prevent the from syncing with the data object and only update the respective data object after the change event.

Code Example

The we need to wrap our inputs into a form html element tag. I know a lot of people ignore this but it is a good practice.

methods:{ formSubmit(){ console.log(this.contact.name); console.log(this.contact.email); this.contact.name='', this.contact.email='', } }

Conclusion

Vue makes it a bit easy to handle forms with the vue-directives and event modifiers which makes it very great to me.

Web developer, Life Café https://medium.com/life-cafe , Curious Soul, twitter at @amjohnphilip,

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store