mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-02 11:17:46 +08:00
fix: input-number in step-strictly onChange bug (#6662)
Co-authored-by: xiaochenchen <xiaochen.chen@igg.com>
This commit is contained in:
parent
23d49c06c2
commit
c6b69e217d
@ -193,6 +193,13 @@ export default defineComponent({
|
||||
}
|
||||
const setCurrentValue = (newVal: number | string) => {
|
||||
const oldVal = data.currentValue
|
||||
if (props.stepStrictly) {
|
||||
const stepPrecision = getPrecision(props.step)
|
||||
const precisionFactor = 10 ** stepPrecision
|
||||
newVal =
|
||||
(Math.round(newVal / props.step) * precisionFactor * props.step) /
|
||||
precisionFactor
|
||||
}
|
||||
if (typeof newVal === 'number' && props.precision !== undefined) {
|
||||
newVal = toPrecision(newVal, props.precision)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user