[new feature] Card: add price、num slot (#2416)

This commit is contained in:
neverland 2019-01-01 22:05:47 +08:00 committed by GitHub
parent b4788f7b43
commit e078bc9095
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 17 deletions

View File

@ -63,6 +63,8 @@ Use `slot` to custom content.
|------|------| |------|------|
| title | Custom title | | title | Custom title |
| desc | Custom description | | desc | Custom description |
| tags | Custom tags | | num | Custom num |
| price | Custom price |
| thumb | Custom thumb | | thumb | Custom thumb |
| tags | Custom tags |
| footer | Custom footer | | footer | Custom footer |

View File

@ -49,7 +49,7 @@
v-if="isDef(price)" v-if="isDef(price)"
:class="b('price')" :class="b('price')"
> >
{{ currency }} {{ price }} <slot name="price">{{ currency }} {{ price }}</slot>
</div> </div>
<div <div
v-if="isDef(originPrice)" v-if="isDef(originPrice)"
@ -58,10 +58,10 @@
{{ currency }} {{ originPrice }} {{ currency }} {{ originPrice }}
</div> </div>
<div <div
v-if="isDef(num)" v-if="isDef(num) || $slots.num"
:class="b('num')" :class="b('num')"
> >
x {{ num }} <slot name="num">x {{ num }}</slot>
</div> </div>
</div> </div>
</div> </div>

View File

@ -9,13 +9,9 @@ exports[`renders demo correctly 1`] = `
<div class="van-card__title">2018秋冬新款男士休闲时尚军绿飞行夹克秋冬新款男</div> <div class="van-card__title">2018秋冬新款男士休闲时尚军绿飞行夹克秋冬新款男</div>
<div class="van-card__desc van-ellipsis">描述信息</div> <div class="van-card__desc van-ellipsis">描述信息</div>
<div class="van-card__bottom"> <div class="van-card__bottom">
<div class="van-card__price"> <div class="van-card__price">¥ 2.00</div>
¥ 2.00
</div>
<!----> <!---->
<div class="van-card__num"> <div class="van-card__num">x 2</div>
x 2
</div>
</div> </div>
</div> </div>
<!----> <!---->
@ -34,15 +30,11 @@ exports[`renders demo correctly 1`] = `
标签2 标签2
</span></div> </span></div>
<div class="van-card__bottom"> <div class="van-card__bottom">
<div class="van-card__price"> <div class="van-card__price">¥ 2.00</div>
¥ 2.00
</div>
<div class="van-card__origin-price"> <div class="van-card__origin-price">
¥ 10.00 ¥ 10.00
</div> </div>
<div class="van-card__num"> <div class="van-card__num">x 2</div>
x 2
</div>
</div> </div>
</div> </div>
<div class="van-card__footer"> <div class="van-card__footer">

View File

@ -63,6 +63,8 @@ Vue.use(Card);
|------|------| |------|------|
| title | 自定义标题 | | title | 自定义标题 |
| desc | 自定义描述 | | desc | 自定义描述 |
| tags | 自定义描述下方的内容 | | num | 自定义数量 |
| price | 自定义价格 |
| thumb | 自定义图片 | | thumb | 自定义图片 |
| tags | 自定义描述下方的内容 |
| footer | 自定义右下角内容 | | footer | 自定义右下角内容 |