mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +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({
|
export default defineComponent({
|
||||||
name: 'ClientOnly',
|
name: 'ClientOnly',
|
||||||
|
inheritAttrs: false,
|
||||||
// eslint-disable-next-line vue/require-prop-types
|
// eslint-disable-next-line vue/require-prop-types
|
||||||
props: ['fallback', 'placeholder', 'placeholderTag', 'fallbackTag'],
|
props: ['fallback', 'placeholder', 'placeholderTag', 'fallbackTag'],
|
||||||
setup (_, { slots }) {
|
setup (_, { slots, attrs }) {
|
||||||
const mounted = ref(false)
|
const mounted = ref(false)
|
||||||
onMounted(() => { mounted.value = true })
|
onMounted(() => { mounted.value = true })
|
||||||
return (props) => {
|
return (props) => {
|
||||||
@ -13,7 +14,7 @@ export default defineComponent({
|
|||||||
if (slot) { return slot() }
|
if (slot) { return slot() }
|
||||||
const fallbackStr = props.fallback || props.placeholder || ''
|
const fallbackStr = props.fallback || props.placeholder || ''
|
||||||
const fallbackTag = props.fallbackTag || props.placeholderTag || 'span'
|
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