add sku-header-price slot (#705)

* [new feature] add sku-header-price slot
This commit is contained in:
wny
2018-03-16 22:03:42 +08:00
committed by GitHub
parent 4c195fd664
commit f9445ba4ee
5 changed files with 41 additions and 15 deletions

View File

@@ -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 || [];
}