Skip to content

Commit

Permalink
fix(input-number): fix largenumber format bug
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Oct 31, 2024
1 parent 168c5a2 commit 454a8fd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/input-number/hooks/useInputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,18 @@ export default function useInputNumber(props: TdInputNumberProps) {
}
if (largeNumber) {
userInput.value = getUserInput(inputValue);

if (decimalPlaces !== undefined && largeNumberToFixed(inputValue, decimalPlaces, largeNumber) !== val) {
setTValue(userInput.value, { type: 'props', e: undefined });
let completeValue = inputValue;
if (!inputRef.value?.inputRef?.contains(document.activeElement)) {
// isToFixed为true 只可能是string
completeValue = formatUnCompleteNumber(completeValue, {
decimalPlaces: props.decimalPlaces,
largeNumber: props.largeNumber,
isToFixed: true,
}) as string;
}
setTValue(completeValue, { type: 'props', e: undefined });
}
}
},
Expand Down

0 comments on commit 454a8fd

Please sign in to comment.