Replies: 1 comment 2 replies
-
Here may be able to answer your doubts about why this problem occurs. First of all, we must make it clear that there is no parent-child component in If you really need to change the value of the parent (the context), and you want to monitor the change in a controllable/observable way,I thought about the way for your reference: |
Beta Was this translation helpful? Give feedback.
-
Is there a way to have a component update the parent data? Here's a JSFiddle I've put together:
https://jsfiddle.net/v1q6tu4k/
Notice how you can pass the data down fine but when you click the button inside the component it doesn't set the date at the top. I understand why as it's bound to a difference reference.
I tried doing the following to update the initial props:
https://jsfiddle.net/v1q6tu4k/1/
and the following which tries to pass the parent date into the setDate function:
https://jsfiddle.net/v1q6tu4k/2/
However neither of these work. Ideally I'd like to pass this down via v-model and emit any changes up like https://v3.vuejs.org/guide/component-basics.html#using-v-model-on-components.
Beta Was this translation helpful? Give feedback.
All reactions