Skip to content

Commit

Permalink
fix(input): letters input
Browse files Browse the repository at this point in the history
  • Loading branch information
chaishi authored and PengYYYYY committed Sep 28, 2022
1 parent eb27d92 commit 95c954f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/input-number/useInputNumber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ export default function useInputNumber(props: TdInputNumberProps) {

const getUserInput = (value: InputNumberValue) => {
if (!value && value !== 0) return '';
let inputStr = String(value);
let inputStr = value || value === 0 ? String(value) : '';
if (!inputRef.value?.inputRef?.contains(document.activeElement)) {
inputStr = String(
formatToNumber(inputStr, {
decimalPlaces: props.decimalPlaces,
largeNumber: props.largeNumber,
}),
);
const num = formatToNumber(inputStr, {
decimalPlaces: props.decimalPlaces,
largeNumber: props.largeNumber,
});
inputStr = num || num === 0 ? String(num) : '';
if (props.format) {
inputStr = String(props.format(value, { fixedNumber: inputStr }));
}
Expand Down

0 comments on commit 95c954f

Please sign in to comment.