diff --git a/src/card/Card.tsx b/src/card/Card.tsx index 2f5aa6519b..dee578d108 100644 --- a/src/card/Card.tsx +++ b/src/card/Card.tsx @@ -141,15 +141,22 @@ const Card = forwardRef((props, ref) => { ); + let childrenNode: React.ReactNode = null; + if (!Reflect.has(props, 'loading')) { + childrenNode = React.cloneElement(card, { style }); + } else if (React.isValidElement(loading)) { + childrenNode = React.cloneElement(loading, null, card); + } else { + childrenNode = ( + + {card} + + ); + } + return (
- {React.isValidElement(loading) ? ( - React.cloneElement(loading, null, card) - ) : ( - - {card} - - )} + {childrenNode}
); });