Skip to content

Commit

Permalink
fix(ButtonGroup/AvatarGroup): allow v-for (#173)
Browse files Browse the repository at this point in the history
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
  • Loading branch information
discountedcookie and benjamincanac committed May 17, 2023
1 parent ead46f6 commit 3fa10aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/runtime/components/elements/AvatarGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
11 changes: 8 additions & 3 deletions src/runtime/components/elements/ButtonGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down

0 comments on commit 3fa10aa

Please sign in to comment.