1👍
Use an emit. Tell the parent component to update via another GET request or just pass the data back directly.
Child Method:
notifyParent () {
this.$emit('updateProfile')
}
Parent Template:
<ChildComponent v-on:updateProfile="someMethod"/>
Parent Method:
someMethod () {
//GET request or whatever
}
More details here: https://v2.vuejs.org/v2/guide/components-custom-events.html
👤Arc
0👍
The keyword here is eventBus
, you need an eventBus to $emit an event changing the data in the parent
component from the grandchild
component. If you only need to change up the data 1 layer instead of 2 in this case, you only need custom event + $emit, without the eventBus. But as it’s greater than 2 layers, you need eventBus
, or even more relegent ways to do state management.
- [Vuejs]-Why namespased: false does not work for me
- [Vuejs]-Vue js "store is not defined" in router.js
Source:stackexchange.com