From b1e3684d4c4b8b9701b15bb120ada4f13ca0d885 Mon Sep 17 00:00:00 2001 From: neverland Date: Mon, 15 Apr 2019 19:18:31 +0800 Subject: [PATCH] [bugfix] Card: should not render empty bottom div (#3152) --- packages/card/index.tsx | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/packages/card/index.tsx b/packages/card/index.tsx index ebc3f5b10..9d4546896 100644 --- a/packages/card/index.tsx +++ b/packages/card/index.tsx @@ -51,6 +51,7 @@ function Card( const showNum = slots.num || isDef(props.num); const showPrice = slots.price || isDef(props.price); const showOriginPrice = slots['origin-price'] || isDef(props.originPrice); + const showBottom = showNum || showPrice || showOriginPrice; const Thumb = showThumb && ( @@ -81,9 +82,7 @@ function Card( const Desc = slots.desc ? slots.desc() - : props.desc && ( -
{props.desc}
- ); + : props.desc &&
{props.desc}
; const Price = showPrice && (
@@ -103,9 +102,7 @@ function Card(
{slots.num ? slots.num() : `x ${props.num}`}
); - const Footer = slots.footer && ( -
{slots.footer()}
- ); + const Footer = slots.footer &&
{slots.footer()}
; return (
@@ -115,11 +112,13 @@ function Card( {Title} {Desc} {slots.tags && slots.tags()} -
- {Price} - {OriginPrice} - {Num} -
+ {showBottom && ( +
+ {Price} + {OriginPrice} + {Num} +
+ )}
{Footer}