fix: fix tabs not displaying properly

This commit is contained in:
xzdry 2022-03-09 11:38:26 +08:00
parent 9b27d6fc8c
commit c571dc357b

View File

@ -24,6 +24,10 @@ const TabsImpl: ComponentImpl<Static<typeof TabsPropsSchema>> = props => {
}
}, [getElement, ref]);
const slots = Array.isArray(slotsElements.content)
? slotsElements.content
: [slotsElements.content];
return (
<BaseTabs
className={css(customStyle?.content)}
@ -37,7 +41,7 @@ const TabsImpl: ComponentImpl<Static<typeof TabsPropsSchema>> = props => {
>
{tabNames.map((tabName, idx) => (
<TabPane key={String(idx)} title={tabName}>
{(slotsElements.content as React.ReactElement[])[idx]}
{slots[idx]}
</TabPane>
))}
</BaseTabs>