mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-09-06 16:09:44 +08:00
feat(Card): add slots attrs (#2787)
This commit is contained in:
parent
e3941c79c2
commit
a63d5651b4
@ -71,6 +71,8 @@
|
|||||||
| title | 自定义标题栏,如果设置了`title`属性则不生效 |
|
| title | 自定义标题栏,如果设置了`title`属性则不生效 |
|
||||||
| desc | 自定义描述栏,如果设置了`desc`属性则不生效 |
|
| desc | 自定义描述栏,如果设置了`desc`属性则不生效 |
|
||||||
| price-top | 自定义价格上方区域 |
|
| price-top | 自定义价格上方区域 |
|
||||||
|
| price | 自定义价格 |
|
||||||
|
| num | 自定义数量 |
|
||||||
| thumb | 自定义 thumb,如果设置了`thumb`属性则不生效 |
|
| thumb | 自定义 thumb,如果设置了`thumb`属性则不生效 |
|
||||||
| bottom | 自定义价格下方区域 |
|
| bottom | 自定义价格下方区域 |
|
||||||
| footer | 自定义 footer |
|
| footer | 自定义 footer |
|
||||||
|
@ -8,7 +8,7 @@ VantComponent({
|
|||||||
'thumb-class',
|
'thumb-class',
|
||||||
'title-class',
|
'title-class',
|
||||||
'price-class',
|
'price-class',
|
||||||
'origin-price-class',
|
'origin-price-class'
|
||||||
],
|
],
|
||||||
|
|
||||||
mixins: [link],
|
mixins: [link],
|
||||||
@ -43,7 +43,7 @@ VantComponent({
|
|||||||
const priceArr = price.toString().split('.');
|
const priceArr = price.toString().split('.');
|
||||||
this.setData({
|
this.setData({
|
||||||
integerStr: priceArr[0],
|
integerStr: priceArr[0],
|
||||||
decimalStr: priceArr[1] ? `.${priceArr[1]}` : '',
|
decimalStr: priceArr[1] ? `.${priceArr[1]}` : ''
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -35,8 +35,10 @@
|
|||||||
<view class="van-card__bottom">
|
<view class="van-card__bottom">
|
||||||
<slot name="price-top" />
|
<slot name="price-top" />
|
||||||
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }}<text class="van-card__price-integer">{{ integerStr }}</text><text class="van-card__price-decimal">{{ decimalStr }}</text></view>
|
<view wx:if="{{ price || price === 0 }}" class="van-card__price price-class">{{ currency }}<text class="van-card__price-integer">{{ integerStr }}</text><text class="van-card__price-decimal">{{ decimalStr }}</text></view>
|
||||||
|
<slot wx:else name="price" />
|
||||||
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
|
<view wx:if="{{ originPrice || originPrice === 0 }}" class="van-card__origin-price origin-price-class">{{ currency }} {{ originPrice }}</view>
|
||||||
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
<view wx:if="{{ num }}" class="van-card__num num-class">x {{ num }}</view>
|
||||||
|
<slot wx:else name="num" />
|
||||||
<slot name="bottom" />
|
<slot name="bottom" />
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user