fix(Sku): stepper value must be integer (#5202)

This commit is contained in:
Waiter 2019-12-05 19:30:06 +08:00 committed by neverland
parent 36086ff938
commit 31d645959d

View File

@ -41,7 +41,8 @@ export default createComponent({
watch: { watch: {
currentNum(num) { currentNum(num) {
this.skuEventBus.$emit('sku:numChange', num); const intValue = parseInt(num, 10);
this.skuEventBus.$emit('sku:numChange', intValue);
}, },
stepperLimit(limit) { stepperLimit(limit) {
@ -122,9 +123,10 @@ export default createComponent({
}, },
onChange(currentValue) { onChange(currentValue) {
const intValue = parseInt(currentValue, 10);
const { handleStepperChange } = this.customStepperConfig; const { handleStepperChange } = this.customStepperConfig;
handleStepperChange && handleStepperChange(currentValue); handleStepperChange && handleStepperChange(intValue);
this.$emit('change', currentValue); this.$emit('change', intValue);
}, },
checkState(min, max) { checkState(min, max) {
@ -159,6 +161,7 @@ export default createComponent({
min={this.stepperMinLimit} min={this.stepperMinLimit}
max={this.stepperLimit} max={this.stepperLimit}
disableInput={this.disableStepperInput} disableInput={this.disableStepperInput}
integer
onOverlimit={this.onOverLimit} onOverlimit={this.onOverLimit}
onChange={this.onChange} onChange={this.onChange}
/> />