-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: mention
<DevOnly>
component in api section (#26029)
- Loading branch information
Showing
4 changed files
with
86 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: '<DevOnly>' | ||
description: Render components only during development with the <DevOnly> component. | ||
links: | ||
- label: Source | ||
icon: i-simple-icons-github | ||
to: https://github.com/nuxt/nuxt/blob/main/packages/nuxt/src/app/components/dev-only.ts | ||
size: xs | ||
--- | ||
|
||
Nuxt provides the `<DevOnly>` component to render a component only during development. | ||
|
||
The content will not be included in production builds. | ||
|
||
```vue [pages/example.vue] | ||
<template> | ||
<div> | ||
<Sidebar /> | ||
<DevOnly> | ||
<!-- this component will only be rendered during development --> | ||
<LazyDebugBar /> | ||
<!-- if you ever require to have a replacement during production --> | ||
<!-- be sure to test these using `nuxt preview` --> | ||
<template #fallback> | ||
<div><!-- empty div for flex.justify-between --></div> | ||
</template> | ||
</DevOnly> | ||
</div> | ||
</template> | ||
``` | ||
|
||
## Slots | ||
|
||
- `#fallback`: if you ever require to have a replacement during production. | ||
|
||
```vue | ||
<template> | ||
<div> | ||
<Sidebar /> | ||
<DevOnly> | ||
<!-- this component will only be rendered during development --> | ||
<LazyDebugBar /> | ||
<!-- be sure to test these using `nuxt preview` --> | ||
<template #fallback> | ||
<div><!-- empty div for flex.justify-between --></div> | ||
</template> | ||
</DevOnly> | ||
</div> | ||
</template> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters