Key part that I left out. The child component is created multiple times in a v-for so $refs needed to be indexed.
saveItem(index) {
this.$refs.actionInput[index].saveData();
}
Inspect console and console.log() is your friend :)
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
So a pretty basic setup
Child component in the parent
<actions :item="item" @save="actionData" ref="actionInput"></actions>
The method in the child
methods: {
saveData() {
console.log("fired");
}
},
I'm calling the saveData() method from the parent like so.
saveItem() {
this.$refs.actionInput.saveData();
},
but I get this error. Uncaught TypeError: this.$refs.actionInput.saveData is not a function
Any ideas?
Thanks!
Key part that I left out. The child component is created multiple times in a v-for so $refs needed to be indexed.
saveItem(index) {
this.$refs.actionInput[index].saveData();
}
Inspect console and console.log() is your friend :)
Please or to participate in this conversation.