DEV Community

Mohsen Fallahnejad
Mohsen Fallahnejad

Posted on • Edited on

1

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.

Heroku

Amplify your impact where it matters most — building exceptional apps.

Leave the infrastructure headaches to us, while you focus on pushing boundaries, realizing your vision, and making a lasting impression on your users.

Get Started

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please show some love ❤️ or share a kind word in the comments if you found this useful!

Got it!