There are notes in the Vue docs (https://v2.vuejs.org/v2/guide/components.html#Listening-to-Child-Components-Events) but would this apply to grandchildren as well?
grandchild.vue
<select class="form-control" v-model="selected" @change="updateValue()" >
...
</select>
methods: {
updateValue: function () {
this.$emit('refreshModel', this.selected)
this.$emit('input', this.selected)
console.log('selected ' + this.selected + ' in ' + this.$props.field)
}
}
Grandparent.vue
<parent-form ...
v-on:refresh-model="refreshModel"
...
</parent-form>
methods: {
refreshModel: function (event) {
console.log("Hello Vue JS");
},
Obviously I have removed a lot of the code and hopefully just left the essentials.
The result of running this is the that the log statement in the grandchild is displayed but not the refreshModel function.
Can anyone see what I am doing wrong?
Regards