fix(ButtonGroup/AvatarGroup): allow v-for (#173)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
ciaasteczkowy
2023-05-17 17:46:26 +07:00
committed by GitHub
parent ead46f6798
commit 3fa10aa4eb
2 changed files with 16 additions and 6 deletions

View File

@@ -36,10 +36,15 @@ export default defineComponent({
const children = computed(() => {
let children = slots.default?.()
// @ts-ignore-next
if (children.length && children[0].type.name === 'ContentSlot') {
if (children.length) {
if (typeof children[0].type === 'symbol') {
// @ts-ignore-next
children = children[0].children
// @ts-ignore-next
children = children[0].ctx.slots.default?.()
} else if (children[0].type.name === 'ContentSlot') {
// @ts-ignore-next
children = children[0].ctx.slots.default?.()
}
}
return children
})

View File

@@ -30,10 +30,15 @@ export default defineComponent({
const children = computed(() => {
let children = slots.default?.()
// @ts-ignore-next
if (children.length && children[0].type.name === 'ContentSlot') {
if (children.length) {
if (typeof children[0].type === 'symbol') {
// @ts-ignore-next
children = children[0].children
// @ts-ignore-next
children = children[0].ctx.slots.default?.()
} else if (children[0].type.name === 'ContentSlot') {
// @ts-ignore-next
children = children[0].ctx.slots.default?.()
}
}
return children
})