mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(nuxt): avoid passing attrs to default slot for ClientOnly (#8921)
This commit is contained in:
parent
dc22bd3829
commit
8c4ff5c585
@ -2,9 +2,10 @@ import { ref, onMounted, defineComponent, createElementBlock, h, createElementVN
|
||||
|
||||
export default defineComponent({
|
||||
name: 'ClientOnly',
|
||||
inheritAttrs: false,
|
||||
// eslint-disable-next-line vue/require-prop-types
|
||||
props: ['fallback', 'placeholder', 'placeholderTag', 'fallbackTag'],
|
||||
setup (_, { slots }) {
|
||||
setup (_, { slots, attrs }) {
|
||||
const mounted = ref(false)
|
||||
onMounted(() => { mounted.value = true })
|
||||
return (props) => {
|
||||
@ -13,7 +14,7 @@ export default defineComponent({
|
||||
if (slot) { return slot() }
|
||||
const fallbackStr = props.fallback || props.placeholder || ''
|
||||
const fallbackTag = props.fallbackTag || props.placeholderTag || 'span'
|
||||
return createElementBlock(fallbackTag, null, fallbackStr)
|
||||
return createElementBlock(fallbackTag, attrs, fallbackStr)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user