mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
修复sku错误文案显示,增加sku-body-top slot,增加resetSelectedSkuOnHide参数
This commit is contained in:
parent
439899018c
commit
1c8d77e466
@ -366,7 +366,7 @@ export default {
|
||||
extend: null,
|
||||
kdt_id: 55,
|
||||
discount_price: 0,
|
||||
stock_num: 6,
|
||||
stock_num: 4,
|
||||
stock_mode: 0,
|
||||
is_sell: null,
|
||||
combin_sku: false,
|
||||
@ -506,7 +506,7 @@ export default {
|
||||
alias: '2oml0r0n5vytj',
|
||||
quota: 15,
|
||||
is_virtual: '0',
|
||||
quota_used: 0,
|
||||
quota_used: 1,
|
||||
goods_info: {
|
||||
title: 'Goods Name',
|
||||
picture: 'https://img.yzcdn.cn/upload_files/2017/03/16/Fs_OMbSFPa183sBwvG_94llUYiLa.jpeg?imageView2/2/w/100/h/100/q/75/format/jpg',
|
||||
|
@ -11,6 +11,7 @@
|
||||
:quota="$t('sku').quota"
|
||||
:quota-used="$t('sku').quota_used"
|
||||
:reset-stepper-on-hide="true"
|
||||
:reset-selected-sku-on-hide="true"
|
||||
:disable-stepper-input="true"
|
||||
@buy-clicked="handleBuyClicked"
|
||||
@add-cart="handleAddCartClicked"
|
||||
|
@ -20,6 +20,7 @@ Vue.use(Sku);
|
||||
:quota="quota"
|
||||
:quota-used="quotaUsed"
|
||||
:reset-stepper-on-hide="resetStepperOnHide"
|
||||
:reset-selected-sku-on-hide="resetSelectedSkuOnHide"
|
||||
:disable-stepper-input="disableStepperInput"
|
||||
@buy-clicked="handleBuyClicked"
|
||||
@add-cart="handleAddCartClicked"
|
||||
@ -70,6 +71,7 @@ Vue.use(Sku);
|
||||
| quota | Quota (0 as no limit) | `Number` | `0` | - |
|
||||
| quota-used | Used quota | `Number` | `0` | - |
|
||||
| reset-stepper-on-hide | Whether to reset stepper when hide | `Boolean` | `false` | - |
|
||||
| reset-selected-sku-on-hide | Whether to reset selected sku when hide | `Boolean` | `false` | - |
|
||||
| disable-stepper-input | Whether to disable stepper input | `Boolean` | `false` | - |
|
||||
| stepper-title | Quantity title | `String` | `Quantity` | - |
|
||||
|
||||
@ -85,6 +87,7 @@ Vue.use(Sku);
|
||||
| Name | Description |
|
||||
|-----------|-----------|
|
||||
| sku-header | Custom header |
|
||||
| sku-body-top | Custom content before sku-group |
|
||||
| sku-group | Custom sku |
|
||||
| extra-sku-group | Extra custom content |
|
||||
| sku-stepper | Custom stepper |
|
||||
|
@ -20,6 +20,7 @@ Vue.use(Sku);
|
||||
:quota="quota"
|
||||
:quota-used="quotaUsed"
|
||||
:reset-stepper-on-hide="resetStepperOnHide"
|
||||
:reset-selected-sku-on-hide="resetSelectedSkuOnHide"
|
||||
:disable-stepper-input="disableStepperInput"
|
||||
@buy-clicked="handleBuyClicked"
|
||||
@add-cart="handleAddCartClicked"
|
||||
@ -71,6 +72,7 @@ Vue.use(Sku);
|
||||
| quota | 限购数(0表示不限购) | `Number` | `0` | - |
|
||||
| quota-used | 已经购买过的数量 | `Number` | `0` | - |
|
||||
| reset-stepper-on-hide | 窗口隐藏时重置选择的商品数量 | `Boolean` | `false` | - |
|
||||
| reset-selected-sku-on-hide | 窗口隐藏时重置已选择的sku | `Boolean` | `false` | - |
|
||||
| disable-stepper-input | 是否禁用sku中stepper的input框 | `Boolean` | `false` | - |
|
||||
| stepper-title | 数量选择组件左侧文案 | `String` | `购买数量` | - |
|
||||
|
||||
@ -88,6 +90,7 @@ Sku 组件默认划分好了若干区块,这些区块都定义成了 slot,
|
||||
| 名称 | 说明 |
|
||||
|-----------|-----------|
|
||||
| sku-header | 商品信息展示区,包含商品图片、名称、价格等信息 |
|
||||
| sku-body-top | sku展示区上方的slot,无默认展示内容,按需使用 |
|
||||
| sku-group | 商品sku展示区 |
|
||||
| extra-sku-group | 额外商品sku展示区,一般用不到 |
|
||||
| sku-stepper | 商品数量选择区 |
|
||||
|
@ -86,6 +86,7 @@ export default create({
|
||||
this.limitType = QUOTA_LIMIT;
|
||||
} else {
|
||||
limit = this.stock;
|
||||
this.limitType = STOCK_LIMIT;
|
||||
}
|
||||
|
||||
return limit;
|
||||
|
@ -2,6 +2,7 @@
|
||||
<popup v-model="show" v-if="!isSkuEmpty" position="bottom" lock-on-scroll prevent-scroll>
|
||||
<div class="van-sku-container">
|
||||
<div class="van-sku-layout">
|
||||
<!-- sku-header -->
|
||||
<slot name="sku-header" :skuEventBus="skuEventBus" :selectedSku="selectedSku" :selectedSkuComb="selectedSkuComb">
|
||||
<sku-header
|
||||
:sku-event-bus="skuEventBus"
|
||||
@ -12,6 +13,9 @@
|
||||
/>
|
||||
</slot>
|
||||
<div class="van-sku-body" :style="bodyStyle">
|
||||
<!-- sku-body-top -->
|
||||
<slot name="sku-body-top" :selectedSku="selectedSku" :skuEventBus="skuEventBus" />
|
||||
<!-- sku-group -->
|
||||
<slot name="sku-group" :selectedSku="selectedSku" :skuEventBus="skuEventBus">
|
||||
<div v-if="hasSku" class="van-sku-group-container van-hairline--bottom">
|
||||
<div
|
||||
@ -35,7 +39,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</slot>
|
||||
<!-- extra-sku-group -->
|
||||
<slot name="extra-sku-group" :skuEventBus="skuEventBus"/>
|
||||
<!-- sku-stepper -->
|
||||
<slot name="sku-stepper" :skuEventBus="skuEventBus" :selectedSku="selectedSku" :selectedSkuComb="selectedSkuComb" :selectedNum="selectedNum">
|
||||
<sku-stepper
|
||||
ref="skuStepper"
|
||||
@ -51,6 +57,7 @@
|
||||
:hide-stock="hideStock"
|
||||
/>
|
||||
</slot>
|
||||
<!-- sku-messages -->
|
||||
<slot name="sku-messages">
|
||||
<sku-messages
|
||||
ref="skuMessages"
|
||||
@ -60,6 +67,7 @@
|
||||
/>
|
||||
</slot>
|
||||
</div>
|
||||
<!-- sku-actions -->
|
||||
<slot name="sku-actions" :skuEventBus="skuEventBus">
|
||||
<sku-actions
|
||||
:sku-event-bus="skuEventBus"
|
||||
@ -134,6 +142,7 @@ export default create({
|
||||
default: 200
|
||||
},
|
||||
resetStepperOnHide: Boolean,
|
||||
resetSelectedSkuOnHide: Boolean,
|
||||
disableStepperInput: Boolean,
|
||||
messagePlaceholderMap: {
|
||||
type: Object,
|
||||
@ -168,6 +177,10 @@ export default create({
|
||||
if (this.resetStepperOnHide) {
|
||||
this.$refs.skuStepper && this.$refs.skuStepper.setCurrentNum(1);
|
||||
}
|
||||
|
||||
if (this.resetSelectedSkuOnHide) {
|
||||
this.resetSelectedSku(this.skuTree);
|
||||
}
|
||||
}
|
||||
},
|
||||
value(val) {
|
||||
|
@ -26,7 +26,8 @@ describe('Sku', (done) => {
|
||||
sku: data.sku,
|
||||
goodsId: data.goods_id,
|
||||
goods: goods,
|
||||
resetStepperOnHide: true
|
||||
resetStepperOnHide: true,
|
||||
resetSelectedSkuOnHide: true
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user