[Vuejs]-Sending a prop using sync and binding it using v-model in child

1👍

You can’t use v-model with a prop because props are meant to be readonly.

Instead, bind <b-collapse>.visible to the visible prop, and emit the update:visible event with the event data whenever <b-collapse>.input event occurs. The update:visible event updates the parent’s visible prop via the .sync modifier.

<b-collapse :visible="visible" @input="$emit('update:visible', $event)">

demo

Leave a comment