I have created a custom input component in Vue
<template>
<input :type="inputType" :placeholder="placeholder" v-model="vModel" />
</template>
<script>
export default {
name: "BaseInput",
props: {
inputType: String,
placeholder: String,
label: String,
vModel: String,
},
};
</script>
I don't know how exactly to pass the data that to be bounded from where we are calling the custom component
My App.vue
<template>
<img alt="Vue logo" src="./assets/logo.png" />
<base-input inputType="text" placeholder="Enter Name" vModel="inputName">
</base-input>
</template>
<script>
import BaseInput from "./components/BaseInput.vue";
export default {
name: "App",
components: {
BaseInput,
},
data() {
return {
inputName: "",
};
},
};
</script>
I referred to How to enable v-model on custom component? but I couldn't understand
How can I achieve this? Thanks in advance