Fix the problem of incorrect decimal point input when editbox input type is number (#18118)

Co-authored-by: qiuguohua <guohua.qiu@cocos.com>
This commit is contained in:
qiuguohua
2025-01-03 16:51:21 +08:00
committed by GitHub
parent 33b0a50e79
commit 4530923a50
+1 -1
View File
@@ -646,7 +646,7 @@ export class EditBoxImpl extends EditBoxImplBase {
const delegate = this._delegate;
// input of number type doesn't support maxLength attribute
const maxLength = delegate!.maxLength;
if (maxLength >= 0) {
if (maxLength >= 0 && elem.type !== 'number') {
elem.value = elem.value.slice(0, maxLength);
}
delegate!._editBoxTextChanged(elem.value);