[bugfix] Stepper: should convert value type (#1838)

This commit is contained in:
neverland 2019-08-07 15:18:48 +08:00 committed by GitHub
parent 696da2e30d
commit 5580379153
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,14 +86,14 @@ VantComponent({
this.triggerInput(value); this.triggerInput(value);
}, },
onChange(type) { onChange(type: string) {
if (this.data[`${type}Disabled`]) { if (this.data[`${type}Disabled`]) {
this.$emit('overlimit', type); this.$emit('overlimit', type);
return; return;
} }
const diff = type === 'minus' ? -this.data.step : +this.data.step; const diff = type === 'minus' ? -this.data.step : +this.data.step;
const value = Math.round((this.data.value + diff) * 100) / 100; const value = Math.round((+this.data.value + diff) * 100) / 100;
this.triggerInput(this.range(value)); this.triggerInput(this.range(value));
this.$emit(type); this.$emit(type);
}, },