[Improvement] Stepper: better input experience(#1484)

This commit is contained in:
SnowZhangXl
2018-07-17 21:33:28 +08:00
committed by neverland
parent 1f5a409112
commit a99e73e07e
2 changed files with 11 additions and 9 deletions

View File

@@ -80,7 +80,6 @@ export default create({
watch: {
value(val) {
if (val !== '') {
val = this.correctValue(+val);
if (val !== this.currentValue) {
this.currentValue = val;
}
@@ -101,7 +100,7 @@ export default create({
onInput(event) {
const { value } = event.target;
this.currentValue = value ? this.correctValue(+value) : value;
this.currentValue = Math.min(this.max, value);
event.target.value = this.currentValue;
this.emitInput();
},
@@ -122,8 +121,10 @@ export default create({
onBlur(event) {
if (!this.value) {
this.currentValue = +this.min;
this.emitInput();
} else {
this.currentValue = this.correctValue(+this.currentValue);
}
this.emitInput();
this.$emit('blur', event);
},