mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-20 15:01:46 +01:00
feat(Pagination): new component (#257)
Co-authored-by: Benjamin Canac <canacb1@gmail.com> Co-authored-by: Haytham A. Salama <haythamasalama@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f7a34c8fee
commit
f0b24ba25d
@@ -18,14 +18,18 @@ export const omit = (obj: object, keys: string[]) => {
|
||||
export const getSlotsChildren = (slots: any) => {
|
||||
let children = slots.default?.()
|
||||
if (children.length) {
|
||||
if (typeof children[0].type === 'symbol') {
|
||||
// @ts-ignore-next
|
||||
children = children[0].children
|
||||
// @ts-ignore-next
|
||||
} else if (children[0].type.name === 'ContentSlot') {
|
||||
// @ts-ignore-next
|
||||
children = children[0].ctx.slots.default?.()
|
||||
}
|
||||
children = children.flatMap(c => {
|
||||
if (typeof c.type === 'symbol') {
|
||||
if (typeof c.children === 'string') {
|
||||
// `v-if="false"` or commented node
|
||||
return
|
||||
}
|
||||
return c.children
|
||||
} else if (c.type.name === 'ContentSlot') {
|
||||
return c.ctx.slots.default?.()
|
||||
}
|
||||
return c
|
||||
}).filter(Boolean)
|
||||
}
|
||||
return children
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user