support InputNumber
support InputNumber
This commit is contained in:
parent
456daf3492
commit
c97c42ab2e
8 changed files with 50 additions and 14 deletions
|
@ -92,7 +92,8 @@
|
|||
return {
|
||||
focused: false,
|
||||
upDisabled: false,
|
||||
downDisabled: false
|
||||
downDisabled: false,
|
||||
currentValue: this.value
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
@ -164,7 +165,7 @@
|
|||
}
|
||||
|
||||
const targetVal = Number(e.target.value);
|
||||
let val = Number(this.value);
|
||||
let val = Number(this.currentValue);
|
||||
const step = Number(this.step);
|
||||
if (isNaN(val)) {
|
||||
return false;
|
||||
|
@ -196,9 +197,11 @@
|
|||
},
|
||||
setValue (val) {
|
||||
this.$nextTick(() => {
|
||||
this.value = val;
|
||||
this.currentValue = val;
|
||||
this.$emit('input', val);
|
||||
this.$emit('on-change', val);
|
||||
this.$dispatch('on-form-change', val);
|
||||
// todo 事件
|
||||
// this.$dispatch('on-form-change', val);
|
||||
});
|
||||
},
|
||||
focus () {
|
||||
|
@ -224,7 +227,7 @@
|
|||
|
||||
if (isValueNumber(val)) {
|
||||
val = Number(val);
|
||||
this.value = val;
|
||||
this.currentValue = val;
|
||||
|
||||
if (val > max) {
|
||||
this.setValue(max);
|
||||
|
@ -234,7 +237,7 @@
|
|||
this.setValue(val);
|
||||
}
|
||||
} else {
|
||||
event.target.value = this.value;
|
||||
event.target.value = this.currentValue;
|
||||
}
|
||||
},
|
||||
changeVal (val) {
|
||||
|
@ -250,11 +253,14 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
compiled () {
|
||||
this.changeVal(this.value);
|
||||
mounted () {
|
||||
this.changeVal(this.currentValue);
|
||||
},
|
||||
watch: {
|
||||
value (val) {
|
||||
this.currentValue = val;
|
||||
},
|
||||
currentValue (val) {
|
||||
this.changeVal(val);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue