<ClientOnly> component is used for purposely rendering a component only on client side.
The content of the default slot will be tree-shaken out of the server build. (This does mean that any CSS used by components within it may not be inlined when rendering the initial HTML.)
Props
Specify a tag to be rendered server-side. Alias:
fallbackTagSpecify a tag to be rendered server-side. Alias:
placeholderTagSpecify a content to be rendered server-side. Alias:
fallbackSpecify a content to be rendered server-side. Alias:
placeholderUsage
Slots
#fallback
Specify a content to be rendered on the server and displayed until <ClientOnly> is mounted in the browser.
[app/pages/example.vue]
Examples
Accessing HTML Elements
Components inside<ClientOnly> are rendered only after being mounted. To access the rendered elements in the DOM, you can watch a template ref:
[app/pages/example.vue]