mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 02:31:21 +00:00
[new feature] Card: add origin-price slot (#2588)
This commit is contained in:
@@ -23,7 +23,12 @@ export default sfc({
|
||||
render(h) {
|
||||
const { thumb, $slots: slots } = this;
|
||||
|
||||
const Thumb = (slots.thumb || thumb) && (
|
||||
const showThumb = slots.thumb || thumb;
|
||||
const showNum = slots.num || isDef(this.num);
|
||||
const showPrice = slots.price || isDef(this.price);
|
||||
const showOriginPrice = slots['origin-price'] || isDef(this.originPrice);
|
||||
|
||||
const Thumb = showThumb && (
|
||||
<a href={this.thumbLink} class={bem('thumb')}>
|
||||
{slots.thumb ||
|
||||
(this.lazyLoad ? (
|
||||
@@ -44,17 +49,17 @@ export default sfc({
|
||||
const Desc =
|
||||
slots.desc || (this.desc && <div class={[bem('desc'), 'van-ellipsis']}>{this.desc}</div>);
|
||||
|
||||
const Price = (slots.price || isDef(this.price)) && (
|
||||
const Price = showPrice && (
|
||||
<div class={bem('price')}>{slots.price || `${this.currency} ${this.price}`}</div>
|
||||
);
|
||||
|
||||
const OriginPrice = isDef(this.originPrice) && (
|
||||
<div class={bem('origin-price')}>{`${this.currency} ${this.originPrice}`}</div>
|
||||
const OriginPrice = showOriginPrice && (
|
||||
<div class={bem('origin-price')}>
|
||||
{slots['origin-price'] || `${this.currency} ${this.originPrice}`}
|
||||
</div>
|
||||
);
|
||||
|
||||
const Num = (slots.num || isDef(this.num)) && (
|
||||
<div class={bem('num')}>{slots.num || `x ${this.num}`}</div>
|
||||
);
|
||||
const Num = showNum && <div class={bem('num')}>{slots.num || `x ${this.num}`}</div>;
|
||||
|
||||
const Footer = slots.footer && <div class={bem('footer')}>{slots.footer}</div>;
|
||||
|
||||
|
Reference in New Issue
Block a user