Calling child function in dynamic route [id].vue

I am trying to call a function in my current Nuxt page from my NavBar.😅

This works fine when I am just using normal pages
<NuxtPage ref="page" />

in template and:
const page = ref(null)
  page.value.pageRef.foo()

in my app.vue file

However if instead the page is a dynamic route. Put inside a folder projects as [id].vue
The same code doesn't work. Even though I am using defineExpose({foo}) from the [id].vue file

Any ideas? I tried to see if I could extract it from a deeper layer of the "page.value.pageRef" object but it just returns a proxy object and I can't seem to extract anything

Help is much appreciated or thoughts on better ways to communicate from a button in nav with a nested page route (I don't really want to send data back and forth through the pages)

Thanks🙏
Screenshot_2024-10-06_at_22.26.08.png
Was this page helpful?