push variables to parent vue code example
Example: vuejs push data update parent
<!--
From the child component, you want to do an "emit". This tells the
parent to run a function which is specified in the child component
reference. Using Pseudo code here:
-->
<parent>
<child
:child-data="data"
@updateParentData="updateData">
</child>
<ChildScript>
methods: {
updateParentData() {
Vue.$emit('updateParentData', childData);
}
}
</ChildScript>
</parent>
<ParentScript>
methods: {
updateData(childData) {
// Do some stuff with child data
}
}
</ParentScript>