From 082b0d63982bc46db2d76577d7b66cddca48b033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E5=A4=9A=E7=9B=8A?= Date: Mon, 25 Dec 2023 11:31:01 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20input-number=20=E5=9C=A8=E5=A4=A7?= =?UTF-8?q?=E6=95=B0=E8=BE=93=E5=85=A5=E4=B8=8B=E4=B8=8D=E5=A4=84=E7=90=86?= =?UTF-8?q?=E7=B2=BE=E5=BA=A6=20Closes=20#6334=20(#9012)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis/src/renderers/Form/InputNumber.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/amis/src/renderers/Form/InputNumber.tsx b/packages/amis/src/renderers/Form/InputNumber.tsx index 6f2910ba4..2294eff4a 100644 --- a/packages/amis/src/renderers/Form/InputNumber.tsx +++ b/packages/amis/src/renderers/Form/InputNumber.tsx @@ -187,7 +187,7 @@ export default class NumberControl extends React.Component< this.handleChangeUnit = this.handleChangeUnit.bind(this); const unit = this.getUnit(); const unitOptions = normalizeOptions(props.unitOptions); - const {formItem, setPrinstineValue, precision, step, value} = props; + const {formItem, setPrinstineValue, precision, step, value, big} = props; const normalizedPrecision = NumberInput.normalizePrecision( this.filterNum(precision), this.filterNum(step) @@ -201,7 +201,9 @@ export default class NumberControl extends React.Component< formItem && value != null && normalizedPrecision != null && - (!unit || unitOptions.length === 0) + (!unit || unitOptions.length === 0) && + // 大数下不需要进行精度处理,因为输入输出都是字符串 + big !== true ) { const normalizedValue = parseFloat( toFixed(value.toString(), '.', normalizedPrecision)