[new feature] Card: add tag slot (#2636)

This commit is contained in:
neverland
2019-01-27 17:27:38 +08:00
committed by GitHub
parent e4327a3ebd
commit d42f866cd8
4 changed files with 16 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ export default sfc({
const { thumb, $slots: slots } = this;
const showThumb = slots.thumb || thumb;
const showTag = slots.tag || this.tag;
const showNum = slots.num || isDef(this.num);
const showPrice = slots.price || isDef(this.price);
const showOriginPrice = slots['origin-price'] || isDef(this.originPrice);
@@ -37,10 +38,14 @@ export default sfc({
) : (
<img class={bem('img')} src={thumb} />
))}
{this.tag && (
<Tag mark type="danger" class={bem('tag')}>
{this.tag}
</Tag>
{showTag && (
<div class={bem('tag')}>
{slots.tag || (
<Tag mark type="danger">
{this.tag}
</Tag>
)}
</div>
)}
</a>
);