fix: 修复数字输入框存在后缀时,清空数据,光标位置定位不准确

This commit is contained in:
fujianchao 2024-10-11 15:59:40 +08:00 committed by lmaomaoz
parent 38cb208b98
commit afcd44069b

View File

@ -508,6 +508,14 @@ export default class NumberControl extends React.Component<
value = numberFormatter(value, finalPrecision);
}
}
if (
suffix &&
userTyping &&
this.input?.selectionStart === input.length
) {
return `${prefix || ''}${value}`;
}
return `${prefix || ''}${value}${suffix || ''}`;
}
: undefined;