In Vue2 i was using $root.$emit and $root.$on among components, but in Vue3, i cant find the substitute for $root.$on .
//ComponentA.vue
this.$root.$emit('code-fulfill', response.unique_key);
//ComponentZ.vue
this.$root.$on('code-fulfill', (code) => {
this.code = code;
});
how to do the same in Vue3 ?
i know how i can do do the emit,
//ComponentA.vue
<script setup lang="ts">
const emit = defineEmits(['update-number'])
//then
emit('update-number', 4455)
//ComponentZ.vue
**???????**
but the $root.$on i have no idea how to do it, because the root property has no more the property $on.