docs: add warning about .client onMounted hook (#9263)

This commit is contained in:
Julien Huang 2022-11-24 12:15:33 +01:00 committed by GitHub
parent 69e46a1873
commit f1026d4e88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -204,6 +204,10 @@ If a component is meant to be rendered only client-side, you can add the `.clien
This feature only works with Nuxt auto-imports and `#components` imports. Explicitly importing these components from their real paths does not convert them into client-only components. This feature only works with Nuxt auto-imports and `#components` imports. Explicitly importing these components from their real paths does not convert them into client-only components.
:: ::
::alert{type=warning}
`.client` components are rendered only after being mounted. To access the rendered template using `onMounted()`, add `await nextTick()` in the callback of the `onMounted()` hook.
::
## .server Components ## .server Components
`.server` components are fallback components of `.client` components. `.server` components are fallback components of `.client` components.