Nisha Patel
Problem
I'm new in vuejs and I was creating custom components for elements like buttons, links, inputs, etc. This is my input component-
When I use v-model on it, It doesn't work properly
<TextInput type="text" v-model="user_name" />
In this case, user_name has a default value but It doesn't appear in input.
I want to use the v-model with this input and make it usable.
I tried searching online and asking for AI tools but nothing worked for me.
Solution
As >@jaromanda-x mentioned, I added :value in my custom component and triggered an $emit for updating the value of the input. This is the final result that I ended up with -
Now I can use v-model on this component and It's working as expected.
Suggested blog
>Create a project using Vue.js: Beginners Guide
>Authentication with Vue 3 and Firebase
>Plugins and Presets for Vuejs project
>Create a Vue.js application with CLI Services
>Create a project using Vue.js: Beginners Guide
>Create Vue.js application API