diff --git a/packages/nuxt/src/app/components/client-only.mjs b/packages/nuxt/src/app/components/client-only.mjs index f6a679710c..cedbda6763 100644 --- a/packages/nuxt/src/app/components/client-only.mjs +++ b/packages/nuxt/src/app/components/client-only.mjs @@ -1,4 +1,4 @@ -import { ref, onMounted, defineComponent, createElementBlock, h } from 'vue' +import { ref, onMounted, defineComponent, createElementBlock, h, Fragment } from 'vue' export default defineComponent({ name: 'ClientOnly', @@ -19,18 +19,38 @@ export default defineComponent({ }) export function createClientOnly (component) { + const { setup, render: _render, template: _template } = component + if (_render) { + // override the component render (non + + diff --git a/test/fixtures/basic/pages/index.vue b/test/fixtures/basic/pages/index.vue index d9c54e2254..092ca160c3 100644 --- a/test/fixtures/basic/pages/index.vue +++ b/test/fixtures/basic/pages/index.vue @@ -16,6 +16,7 @@ + @@ -31,4 +32,9 @@ useHead({ const foo = useFoo() const bar = useBar() +const clientRef = ref() + +onMounted(() => { + clientRef.value.exposedFunc() +})