mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Card: should not render empty bottom div (#3152)
This commit is contained in:
parent
ffe82e2f06
commit
b1e3684d4c
@ -51,6 +51,7 @@ function Card(
|
|||||||
const showNum = slots.num || isDef(props.num);
|
const showNum = slots.num || isDef(props.num);
|
||||||
const showPrice = slots.price || isDef(props.price);
|
const showPrice = slots.price || isDef(props.price);
|
||||||
const showOriginPrice = slots['origin-price'] || isDef(props.originPrice);
|
const showOriginPrice = slots['origin-price'] || isDef(props.originPrice);
|
||||||
|
const showBottom = showNum || showPrice || showOriginPrice;
|
||||||
|
|
||||||
const Thumb = showThumb && (
|
const Thumb = showThumb && (
|
||||||
<a href={props.thumbLink} class={bem('thumb')}>
|
<a href={props.thumbLink} class={bem('thumb')}>
|
||||||
@ -81,9 +82,7 @@ function Card(
|
|||||||
|
|
||||||
const Desc = slots.desc
|
const Desc = slots.desc
|
||||||
? slots.desc()
|
? slots.desc()
|
||||||
: props.desc && (
|
: props.desc && <div class={[bem('desc'), 'van-ellipsis']}>{props.desc}</div>;
|
||||||
<div class={[bem('desc'), 'van-ellipsis']}>{props.desc}</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const Price = showPrice && (
|
const Price = showPrice && (
|
||||||
<div class={bem('price')}>
|
<div class={bem('price')}>
|
||||||
@ -103,9 +102,7 @@ function Card(
|
|||||||
<div class={bem('num')}>{slots.num ? slots.num() : `x ${props.num}`}</div>
|
<div class={bem('num')}>{slots.num ? slots.num() : `x ${props.num}`}</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
const Footer = slots.footer && (
|
const Footer = slots.footer && <div class={bem('footer')}>{slots.footer()}</div>;
|
||||||
<div class={bem('footer')}>{slots.footer()}</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={bem()} {...inherit(ctx, true)}>
|
<div class={bem()} {...inherit(ctx, true)}>
|
||||||
@ -115,11 +112,13 @@ function Card(
|
|||||||
{Title}
|
{Title}
|
||||||
{Desc}
|
{Desc}
|
||||||
{slots.tags && slots.tags()}
|
{slots.tags && slots.tags()}
|
||||||
|
{showBottom && (
|
||||||
<div class="van-card__bottom">
|
<div class="van-card__bottom">
|
||||||
{Price}
|
{Price}
|
||||||
{OriginPrice}
|
{OriginPrice}
|
||||||
{Num}
|
{Num}
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{Footer}
|
{Footer}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user