docs: warn about ref unwrapping when auto-importing refs (#27933)

This commit is contained in:
Typed SIGTERM 2024-07-01 16:38:03 +08:00 committed by GitHub
parent 4ff29bb165
commit 910814ae18
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -105,6 +105,11 @@ Nuxt directly auto-imports files created in defined directories:
:link-example{to="/docs/examples/features/auto-imports"}
::warning
**Auto-imported `ref` and `computed` won't be unwrapped in a component `<template>`.** :br
This is due to how Vue works with refs that aren't top-level to the template. You can read more about it [in the Vue documentation](https://vuejs.org/guide/essentials/reactivity-fundamentals.html#caveat-when-unwrapping-in-templates).
::
### Explicit Imports
Nuxt exposes every auto-import with the `#imports` alias that can be used to make the import explicit if needed: