0👍
✅
I actually found the solution myself jut now:
In the child component I was trying to access the props’ data through the data object. But I just accessed to props’ data directly like so:
<div
:class="{ 'modal--show': modal }">
...
export default {
props: {
modal: Boolean
}
}
0👍
Correct.
Other options for syncing if this parent/child relationship is more complex, or you needed to pass back upward to the parent:
-
Put the :modal value in a Vuex store and use a computed property on the child component.
-
Use an EventBus: https://alligator.io/vuejs/global-event-bus/
Source:stackexchange.com