[improvement] Card: add origin-price prop (#1916)

This commit is contained in:
neverland
2018-10-11 15:50:26 +08:00
committed by GitHub
parent 1be1f1e53a
commit 4465e6f705
7 changed files with 52 additions and 34 deletions
+14 -12
View File
@@ -2,7 +2,7 @@
<div :class="b({ center: centered })">
<a :href="thumbLink" :class="b('thumb')">
<slot name="thumb">
<img :src="thumb" :class="b('img')" >
<img :src="thumb" :class="b('img')">
</slot>
<van-tag
v-if="tag"
@@ -14,19 +14,20 @@
</van-tag>
</a>
<div :class="b('content')">
<slot name="title">
<div :class="b('row')" v-if="title || isDef(price)">
<div :class="b('left')">
<slot name="title">
<div v-if="title" :class="b('title')">{{ title }}</div>
<div v-if="isDef(price)" :class="b('price')">{{ currency }} {{ price }}</div>
</div>
</slot>
<slot name="desc">
<div :class="b('row')" v-if="desc || isDef(num)">
</slot>
<slot name="desc">
<div v-if="desc" :class="[b('desc'), 'van-ellipsis']">{{ desc }}</div>
<div v-if="isDef(num)" :class="b('num')">x {{ num }}</div>
</div>
</slot>
<slot name="tags" />
</slot>
<slot name="tags" />
</div>
<div :class="b('right')">
<div v-if="isDef(price)">{{ currency }} {{ price }}</div>
<div v-if="isDef(originPrice)" :class="b('origin-price')">{{ currency }} {{ originPrice }}</div>
<div v-if="isDef(num)" :class="b('num')">x {{ num }}</div>
</div>
</div>
<div :class="b('footer')" v-if="$slots.footer">
<slot name="footer" />
@@ -53,6 +54,7 @@ export default create({
centered: Boolean,
num: [Number, String],
price: [Number, String],
originPrice: [Number, String],
currency: {
type: String,
default: '¥'