mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-06 05:09:00 +08:00
fix(components): [input-number] increase and decrease error (#10067)
fix(components): [input-number] increase and decrease error (#10063)
This commit is contained in:
parent
b3be81dc50
commit
a8c6df5958
@ -182,14 +182,14 @@ const ensurePrecision = (val: number, coefficient: 1 | -1 = 1) => {
|
|||||||
}
|
}
|
||||||
const increase = () => {
|
const increase = () => {
|
||||||
if (props.readonly || inputNumberDisabled.value || maxDisabled.value) return
|
if (props.readonly || inputNumberDisabled.value || maxDisabled.value) return
|
||||||
const value = props.modelValue || 0
|
const value = Number(displayValue.value) || 0
|
||||||
const newVal = ensurePrecision(value)
|
const newVal = ensurePrecision(value)
|
||||||
setCurrentValue(newVal)
|
setCurrentValue(newVal)
|
||||||
emit(INPUT_EVENT, data.currentValue)
|
emit(INPUT_EVENT, data.currentValue)
|
||||||
}
|
}
|
||||||
const decrease = () => {
|
const decrease = () => {
|
||||||
if (props.readonly || inputNumberDisabled.value || minDisabled.value) return
|
if (props.readonly || inputNumberDisabled.value || minDisabled.value) return
|
||||||
const value = props.modelValue || 0
|
const value = Number(displayValue.value) || 0
|
||||||
const newVal = ensurePrecision(value, -1)
|
const newVal = ensurePrecision(value, -1)
|
||||||
setCurrentValue(newVal)
|
setCurrentValue(newVal)
|
||||||
emit(INPUT_EVENT, data.currentValue)
|
emit(INPUT_EVENT, data.currentValue)
|
||||||
|
Loading…
Reference in New Issue
Block a user