N
Nuxt6mo ago
Patrik.S

option api - useNuxtApp

Hello, I’m migrating bigger project from nuxt2 to 3 🙈, and I found out that I don’t know how to call plugin in option api. The plugin looks like this:
export default defineNuxtPlugin((nuxtApp) => {
return {
provide: {
hello: () => `Hello`
}
}
})
export default defineNuxtPlugin((nuxtApp) => {
return {
provide: {
hello: () => `Hello`
}
}
})
I know i can get $hello in setup:
const { $hello } = useNuxtApp()
const { $hello } = useNuxtApp()
But the question is how can I get the $hello in option API - I don’t like calling it at every method. At nuxt2 a just call it in method like ‘this.$hello’ and I had full context. Is there any elegant solution for this? Thanks for any advice!
1 Reply
Patrik.S
Patrik.SOP6mo ago
Yeah, that’s true 🤦🏻‍♂️ thanks 🙏
Want results from more Discord servers?
Add your server