[Vuejs]-Sync prop with the parent in Vue?

1👍

You need to emit event in your child component.

I didn’t test this code but it should look something like this.

<template>
  <b-form-group :description="title">
    <b-form-input :value="value" @input="$emit('update:value', $event.target.value)"></b-form-input>
  </b-form-group>
</template>
<script>
export default {
  props: {
    value: String,
    title: String
  }
}
</script>

1👍

You can make your fooBar component to handle prop as a v-model

<foobar title="Foo" v-model:value="shared"></foobar>

Additional documentation available here

Leave a comment