mirror of https://github.com/ElemeFE/element
InputNumber: fix float number (#2017)
parent
a9a3e8b638
commit
69cb4ad698
|
@ -126,10 +126,10 @@
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
minDisabled() {
|
minDisabled() {
|
||||||
return this.value - this.step < this.min;
|
return this.accSub(this.value, this.step) < this.min;
|
||||||
},
|
},
|
||||||
maxDisabled() {
|
maxDisabled() {
|
||||||
return this.value + this.step > this.max;
|
return this.accAdd(this.value, this.step) > this.max;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -181,13 +181,13 @@
|
||||||
increase() {
|
increase() {
|
||||||
if (this.maxDisabled) return;
|
if (this.maxDisabled) return;
|
||||||
const value = this.value || 0;
|
const value = this.value || 0;
|
||||||
if (value + this.step > this.max || this.disabled) return;
|
if (this.accAdd(value, this.step) > this.max || this.disabled) return;
|
||||||
this.currentValue = this.accAdd(this.step, value);
|
this.currentValue = this.accAdd(this.step, value);
|
||||||
},
|
},
|
||||||
decrease() {
|
decrease() {
|
||||||
if (this.minDisabled) return;
|
if (this.minDisabled) return;
|
||||||
const value = this.value || 0;
|
const value = this.value || 0;
|
||||||
if (value - this.step < this.min || this.disabled) return;
|
if (this.accSub(value, this.step) < this.min || this.disabled) return;
|
||||||
this.currentValue = this.accSub(value, this.step);
|
this.currentValue = this.accSub(value, this.step);
|
||||||
},
|
},
|
||||||
handleBlur() {
|
handleBlur() {
|
||||||
|
|
Loading…
Reference in New Issue