mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 01:17:16 +00:00
3ec108493d
* docs: simplify docs to only markdown * Create nuxt-config.md * chore: update * chore: add readme
22 lines
950 B
Markdown
22 lines
950 B
Markdown
---
|
|
description: Nuxt provides utilities to give you control over prefetching and preloading components.
|
|
---
|
|
|
|
# `preloadComponents`
|
|
|
|
Nuxt provides composables and utilities to give you fine-grained control over prefetching and preloading components.
|
|
|
|
> Preloading components loads components that your page will need very soon, which you want to start loading early in rendering lifecycle. This ensures they are available earlier and are less likely to block the page's render, improving performance.
|
|
|
|
Use `preloadComponents` to manually preload individual components that have been registered globally in your Nuxt app. (By default Nuxt registers these as async components.) You must use the Pascal-cased version of the component name.
|
|
|
|
```js
|
|
await preloadComponents('MyGlobalComponent')
|
|
|
|
await preloadComponents(['MyGlobalComponent1', 'MyGlobalComponent2'])
|
|
```
|
|
|
|
::alert{icon=👉}
|
|
Currently, on server, `preloadComponents` will have no effect.
|
|
::
|