Skip to content

Commit

Permalink
fix(card): loading属性增加TNode支持
Browse files Browse the repository at this point in the history
fix #2997
  • Loading branch information
huangchen1031 committed Aug 20, 2024
1 parent f5b208c commit 56a8d03
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,24 @@ const Card = forwardRef<HTMLDivElement, CardProps>((props, ref) => {
);

const card = (
<div ref={ref} className={cardClass}>
<>
{showHeader ? renderHeader() : null}
{renderCover}
{renderChildren}
{renderFooter}
</div>
</>
);

return loading ? (
<Loading {...loadingProps} style={style}>
{card}
</Loading>
) : (
React.cloneElement(card, { style })
return (
<div ref={ref} className={cardClass} style={style}>
{React.isValidElement(loading) ? (
React.cloneElement(loading, null, card)
) : (
<Loading {...loadingProps} loading={!!loading}>
{card}
</Loading>
)}
</div>
);
});

Expand Down

0 comments on commit 56a8d03

Please sign in to comment.