This repository has been archived by the owner on Apr 6, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9d83b3
commit 2644d7e
Showing
1 changed file
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
description: The <ClientOnly> component renders its slot only in client-side. | ||
--- | ||
# `<ClientOnly>` | ||
|
||
The `<ClientOnly>` component renders its slot only in client-side. To import a component only on the client, register the component in a client-side only plugin. | ||
|
||
## Props | ||
|
||
- **placeholderTag** | **fallbackTag**: specify a tag to be rendered server-side. | ||
- **placeholder** | **fallback**: specify a content to be rendered server-side. | ||
|
||
```vue | ||
<template> | ||
<div> | ||
<Sidebar /> | ||
<ClientOnly fallback-tag="span" fallback="Loading comments..."> | ||
<Comment /> | ||
</ClientOnly> | ||
</div> | ||
</template> | ||
``` | ||
|
||
## Slots | ||
|
||
- **#fallback**: specify a content to be displayed server-side. | ||
|
||
```vue | ||
<template> | ||
<div> | ||
<Sidebar /> | ||
<ClientOnly> | ||
<!-- ... --> | ||
<template #fallback> | ||
<!-- this will be rendered on server side --> | ||
<p>Loading comments...</p> | ||
</template> | ||
</ClientOnly> | ||
</div> | ||
</template> | ||
``` |