docs: use `defineNuxtComponent` instead of `defineComponent` (#29011)

This commit is contained in:
Julien Huang 2024-09-16 14:48:45 +02:00 committed by GitHub
parent 4976df6f63
commit ee44ec7309
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -64,6 +64,10 @@ If you get an error message like `Nuxt instance is unavailable` then it probably
Watch a video from Alexander Lichter about handling async code in composables and fixing `Nuxt instance is unavailable` in your app. Watch a video from Alexander Lichter about handling async code in composables and fixing `Nuxt instance is unavailable` in your app.
:: ::
::tip
When using a composable that requires the Nuxt context inside a non-SFC component, you need to wrap your component with `defineNuxtComponent` instead of `defineComponent`
::
::read-more{to="/docs/guide/going-further/experimental-features#asynccontext" icon="i-ph-star-duotone"} ::read-more{to="/docs/guide/going-further/experimental-features#asynccontext" icon="i-ph-star-duotone"}
Checkout the `asyncContext` experimental feature to use Nuxt composables in async functions. Checkout the `asyncContext` experimental feature to use Nuxt composables in async functions.
:: ::