DEV Community

Mohsen Fallahnejad
Mohsen Fallahnejad

Posted on • Updated on

Using function in v-model

In a common definition:
“ The v-model attribute is a way of creating a mutual binding between the user input and the vue.js component. This will automatically pick up changes and store this value in the data properties of the component. This will be commonly used on form input to record the user input.”

This means we should use data properties for this.
Sometimes, we need to use a function (method or computed) with a return value in the v-model, but this causes an error.

we can use :value instead of v-model, Just like that

If you found it useful, you can follow me and also visit my website, because there are more ways to connect with me. I hope this would help you to improve your coding skills. Thank you for your attention.


This article was originally published on The Dev.to on April 4, 2020 and was written by Mohsen Fallahnejad.

Top comments (0)