I have a form in my child component:
<form @submit="submitForm">
<input type="text" v-model="textInput" />
</form>
export default {
name: "childComp",
data: function() {
return {
textInput: ""
}
}
}
Now from my parent component I have a button and I need to click on that button to get the child form data.
<button type="button" @click="getFormData()"> click </button>
export default {
name: "ParentComp",
data: function() {
return {
formData: []
}
},
methods: {
getFormData(d) {
formData.push(d);
console.log(d)
}
}
}
Appreciate your help.