forked from opentiny/tiny-vue
fix(numeric):numeric 修复输入超大数字变为科学计数法时失焦后组件消失的问题 (#563)
* fix(numeric):numeric 输入超大数字变为科学计数法时失焦后组件消失的问题 * fix(numeric):numeric 修改评审意见
This commit is contained in:
parent
95072995f9
commit
2041a44847
|
@ -186,7 +186,7 @@ export class BigIntDecimal {
|
|||
const trimRet = trimNumber(mergedValue)
|
||||
this.negative = trimRet.negative
|
||||
const numbers = trimRet.trimStr.split('.')
|
||||
this.integer = BigInt(numbers[0])
|
||||
this.integer = numbers[0].indexOf('e') === -1 ? BigInt(numbers[0]) : numbers[0]
|
||||
const decimalStr = numbers[1] || '0'
|
||||
this.decimal = convertBigInt(decimalStr)
|
||||
this.decimalLen = decimalStr.length
|
||||
|
|
|
@ -96,6 +96,11 @@ export const increase =
|
|||
}
|
||||
|
||||
const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0
|
||||
|
||||
if (value.toString().includes('e')) {
|
||||
return
|
||||
}
|
||||
|
||||
let newVal = api.internalIncrease({ val: value, step: props.step })
|
||||
|
||||
if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
|
||||
|
@ -116,8 +121,12 @@ export const decrease =
|
|||
if (state.inputDisabled || state.minDisabled) {
|
||||
return
|
||||
}
|
||||
|
||||
const value = (props.mouseWheel ? state.displayValue : props.modelValue) || 0
|
||||
|
||||
if (value.toString().includes('e')) {
|
||||
return
|
||||
}
|
||||
|
||||
let newVal = api.internalDecrease({ val: value, step: props.step })
|
||||
|
||||
if (!props.circulate || !isFinite(props.max) || !isFinite(props.min)) {
|
||||
|
@ -269,7 +278,7 @@ export const handleInput =
|
|||
emitError()
|
||||
|
||||
if (!(value === '' && props.allowEmpty)) {
|
||||
value = state.lastInput
|
||||
value = value.indexOf('e') === -1 ? state.lastInput : value
|
||||
}
|
||||
} else {
|
||||
value = value
|
||||
|
|
Loading…
Reference in New Issue