mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +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) {
|
||||
return defineComponent({
|
||||
name: 'ClientOnlyWrapper',
|
||||
setup (props, { attrs, slots }) {
|
||||
inheritAttrs: false,
|
||||
setup (_props, { attrs, slots }) {
|
||||
const mounted = ref(false)
|
||||
onMounted(() => { mounted.value = true })
|
||||
return () => {
|
||||
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