2022-07-07 16:04:38 +00:00
|
|
|
<script setup lang="ts">
|
2022-10-11 15:26:03 +00:00
|
|
|
// explicit import to bypass client import protection
|
|
|
|
import BreaksServer from '../components/BreaksServer.client'
|
2024-08-12 09:42:47 +00:00
|
|
|
// ensure treeshake-client-only module remove these imports without breaking
|
2023-02-08 08:59:57 +00:00
|
|
|
import TestGlobal from '../components/global/TestGlobal.vue'
|
|
|
|
// direct import of .client components should be treeshaken
|
|
|
|
import { FunctionalComponent, LazyClientOnlyScript } from '#components'
|
2022-10-11 15:26:03 +00:00
|
|
|
|
|
|
|
onMounted(() => import('~/components/BreaksServer.client'))
|
|
|
|
onBeforeMount(() => import('~/components/BreaksServer.client'))
|
|
|
|
onBeforeUpdate(() => import('~/components/BreaksServer.client'))
|
|
|
|
onRenderTracked(() => import('~/components/BreaksServer.client'))
|
|
|
|
onRenderTriggered(() => import('~/components/BreaksServer.client'))
|
|
|
|
onActivated(() => import('~/components/BreaksServer.client'))
|
|
|
|
onDeactivated(() => import('~/components/BreaksServer.client'))
|
|
|
|
onBeforeUnmount(() => import('~/components/BreaksServer.client'))
|
2022-07-07 16:04:38 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
This page should not crash when rendered.
|
2022-07-14 17:46:12 +00:00
|
|
|
<ClientOnly class="something">
|
2023-02-08 08:59:57 +00:00
|
|
|
<span>rendered client-side</span>
|
2022-07-14 17:46:12 +00:00
|
|
|
<BreaksServer />
|
|
|
|
<BreaksServer>Some slot content</BreaksServer>
|
|
|
|
</ClientOnly>
|
|
|
|
This should render.
|
|
|
|
<div>
|
|
|
|
<ClientOnly class="another">
|
2023-02-08 08:59:57 +00:00
|
|
|
<span>rendered client-side</span>
|
2022-07-14 17:46:12 +00:00
|
|
|
<BreaksServer />
|
|
|
|
</ClientOnly>
|
|
|
|
</div>
|
2023-02-08 08:59:57 +00:00
|
|
|
<div>
|
|
|
|
<LazyClientOnly>
|
|
|
|
<div class="red">
|
|
|
|
i'm red
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<BreaksServer />
|
|
|
|
<FunctionalComponent />
|
|
|
|
<TestGlobal />
|
|
|
|
</div>
|
|
|
|
<template #fallback>
|
|
|
|
<div>fallback for ClientOnly</div>
|
|
|
|
</template>
|
|
|
|
</LazyClientOnly>
|
|
|
|
<LazyClientOnlyScript>
|
|
|
|
<template #test>
|
|
|
|
<BreaksServer />
|
|
|
|
<div id="client-side">
|
|
|
|
This should be rendered client-side
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #fallback>
|
|
|
|
<FunctionalComponent />
|
|
|
|
<!-- this should be treeshaken on .client -->
|
|
|
|
<BreaksServer />
|
|
|
|
</template>
|
|
|
|
</LazyClientOnlyScript>
|
|
|
|
<div class="blue">
|
|
|
|
i'm blue
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-07-07 16:04:38 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
2023-02-08 08:59:57 +00:00
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.red {
|
|
|
|
color: rgb(255, 0, 0);
|
|
|
|
}
|
|
|
|
.blue {
|
|
|
|
color: rgb(0, 0, 255);
|
|
|
|
}
|
|
|
|
</style>
|