mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 01:54:48 +00:00
add sku-header-price slot (#705)
* [new feature] add sku-header-price slot
This commit is contained in:
@@ -17,10 +17,19 @@
|
||||
<sku-header
|
||||
:sku-event-bus="skuEventBus"
|
||||
:selected-sku="selectedSku"
|
||||
:selected-sku-comb="selectedSkuComb"
|
||||
:goods="goods"
|
||||
:sku="sku"
|
||||
/>
|
||||
>
|
||||
<slot
|
||||
name="sku-header-price"
|
||||
:price="price"
|
||||
:selected-sku-comb="selectedSkuComb"
|
||||
>
|
||||
<div class="van-sku__goods-price">
|
||||
<span class="van-sku__price-symbol">¥</span><span class="van-sku__price-num">{{ price }}</span>
|
||||
</div>
|
||||
</slot>
|
||||
</sku-header>
|
||||
</slot>
|
||||
<div class="van-sku-body" :style="bodyStyle">
|
||||
<!-- sku-body-top -->
|
||||
@@ -251,6 +260,14 @@ export default create({
|
||||
return null;
|
||||
},
|
||||
|
||||
price() {
|
||||
if (this.selectedSkuComb) {
|
||||
return (this.selectedSkuComb.price / 100).toFixed(2);
|
||||
}
|
||||
// sku.price是一个格式化好的价格区间
|
||||
return this.sku.price;
|
||||
},
|
||||
|
||||
skuTree() {
|
||||
return this.sku.tree || [];
|
||||
}
|
||||
|
Reference in New Issue
Block a user