[Improvement] Sku: add stepper-change event (#1349)

This commit is contained in:
neverland 2018-06-28 17:57:15 +08:00 committed by GitHub
parent 7d97a2fd85
commit 0b94e8cecd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 0 deletions

View File

@ -77,6 +77,7 @@
:disable-stepper-input="disableStepperInput" :disable-stepper-input="disableStepperInput"
:hide-stock="hideStock" :hide-stock="hideStock"
:custom-stepper-config="customStepperConfig" :custom-stepper-config="customStepperConfig"
@change="$emit('stepper-change', $event)"
/> />
</slot> </slot>
<!-- sku-messages --> <!-- sku-messages -->

View File

@ -121,6 +121,7 @@ export default create({
onChange(currentValue) { onChange(currentValue) {
const { handleStepperChange } = this.customStepperConfig; const { handleStepperChange } = this.customStepperConfig;
handleStepperChange && handleStepperChange(currentValue); handleStepperChange && handleStepperChange(currentValue);
this.$emit('change', currentValue);
} }
} }
}); });

View File

@ -108,6 +108,8 @@ Vue.use(Sku);
|-----------|-----------|-----------| |-----------|-----------|-----------|
| add-cart | Triggered when click cart button | data: Object | | add-cart | Triggered when click cart button | data: Object |
| buy-clicked | Triggered when click buy button | data: Object | | buy-clicked | Triggered when click buy button | data: Object |
| stepper-change | Triggered when stepper value changed | value: number |
### Methods ### Methods

View File

@ -109,6 +109,7 @@ Vue.use(Sku);
|-----------|-----------|-----------| |-----------|-----------|-----------|
| add-cart | 点击添加购物车回调 | skuData: Object | | add-cart | 点击添加购物车回调 | skuData: Object |
| buy-clicked | 点击购买回调 | skuData: Object | | buy-clicked | 点击购买回调 | skuData: Object |
| stepper-change | 购买数量变化时触发 | value: number |
### 方法 ### 方法