Looking to convert the code below to use Vue 3 composition API.
I am trying to listen for an event from a child component in a parent component that utilizes the render function. In Vue 3, $on has been removed and I'm unsure of how to replace it in the setup method.
created() {
this.$on('update-visibility', this.updateElementBounds);
}
Context Example
// ...
methods: {
updateElementBounds() {
const {offsetTop, offsetHeight} = this.$el;
this.elementTop = offsetTop;
this.elementHeight = offsetHeight;
},
},
created() {
this.$on('update-visibility', this.updateElementBounds);
},
render() {
const {isPageFocused, isElementFocused} = this;
return this.$scopedSlots.default({
isPageFocused,
isElementFocused,
});
},