-1
code
father:
<template>
<div class="col-6">
<span @changeTitle="changeTitle($event)"> table -[{{title}}]</span><br>
<ModalRegistert />
</div>
</template>
<script>
import ModalRegister from './ModalRegister';
export default {
data: () => ({
title: "asdf"
}),
methods: {
changeTitle: function(newTitle) {
this.title = newTitle,
console.log("updateTitle - table");
}
},
components: {
ModalRegister
}
}
</script>
son:
<template>
<div>
<span>modal - [{{title}}]</span>
<v-btn x-small @click="changeTitle"> add </v-btn><br>
</div>
</template>
<script>
export default {
data: () => ({
title: "asdf"
}),
methods: {
changeTitle() {
console.log("01 - register");
this.title = "new"
this.$emit('changeTitle', "title")
}
},
}
</script>
But it only prints in the log the Register(son), and does not change the title of the parent