I want to bubble up an emit from a child component in ag-grid using vuejs 3. My strategy is to pass the parent component down with the composition API using <script setup> for use in the child component. The manual shows me how to do this with <setup>, but is silent using this syntactic sugar. The problem is that this is empty when passing the parent component. https://www.ag-grid.com/vue-data-grid/component-communication/
// Parent Component
<script setup>
const context = ref(null)
const emit = defineEmits(['action'])
onBeforeMount(() => {
context.value = {
componentParent: this
}
})
</setup>
<template>
<AgGridVue
:context="context"
/>
</template>
// Child component (cellRenderer)
<script setup>
const props = defineProps({
params: Object,
})
const fun = () => {
params.context.componentParent.emit('action')
}
</script>
<template>
<button @click="fun">Click me</button>
</template>