mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-07 09:22:27 +00:00
fix(nuxt): pass attrs and props to client-only components (#5668)
This commit is contained in:
parent
568fcaedfc
commit
fe508f5d20
@ -21,14 +21,15 @@ export default defineComponent({
|
|||||||
export function createClientOnly (component) {
|
export function createClientOnly (component) {
|
||||||
return defineComponent({
|
return defineComponent({
|
||||||
name: 'ClientOnlyWrapper',
|
name: 'ClientOnlyWrapper',
|
||||||
setup (props, { attrs, slots }) {
|
inheritAttrs: false,
|
||||||
|
setup (_props, { attrs, slots }) {
|
||||||
const mounted = ref(false)
|
const mounted = ref(false)
|
||||||
onMounted(() => { mounted.value = true })
|
onMounted(() => { mounted.value = true })
|
||||||
return () => {
|
return () => {
|
||||||
if (mounted.value) {
|
if (mounted.value) {
|
||||||
return h(component, { props, attrs }, slots)
|
return h(component, attrs, slots)
|
||||||
}
|
}
|
||||||
return h('div')
|
return h('div', { class: attrs.class, style: attrs.style })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user