From 56a8d035025e26099866e38b52f98b39cc695061 Mon Sep 17 00:00:00 2001 From: huangchen1031 Date: Tue, 20 Aug 2024 16:52:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(card):=20loading=E5=B1=9E=E6=80=A7=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0TNode=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #2997 --- src/card/Card.tsx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/card/Card.tsx b/src/card/Card.tsx index 1f34ed579e..2f5aa6519b 100644 --- a/src/card/Card.tsx +++ b/src/card/Card.tsx @@ -133,20 +133,24 @@ const Card = forwardRef((props, ref) => { ); const card = ( -
+ <> {showHeader ? renderHeader() : null} {renderCover} {renderChildren} {renderFooter} -
+ ); - return loading ? ( - - {card} - - ) : ( - React.cloneElement(card, { style }) + return ( +
+ {React.isValidElement(loading) ? ( + React.cloneElement(loading, null, card) + ) : ( + + {card} + + )} +
); });