From fc6ad1d0c9ce752f608415f61c59e19ac772ee9f Mon Sep 17 00:00:00 2001 From: qinhaoyan <30946345+qinhaoyan@users.noreply.github.com> Date: Wed, 18 Aug 2021 15:00:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Anumber=E5=90=8E=E7=BC=80=E5=8D=95?= =?UTF-8?q?=E8=AF=8D=E4=BF=AE=E6=94=B9=E4=B8=BAsuffix=20(#2400)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: qinhaoyan --- docs/zh-CN/components/form/input-number.md | 4 ++-- src/renderers/Form/InputNumber.tsx | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/zh-CN/components/form/input-number.md b/docs/zh-CN/components/form/input-number.md index 119542fcf..98ef9c132 100755 --- a/docs/zh-CN/components/form/input-number.md +++ b/docs/zh-CN/components/form/input-number.md @@ -37,7 +37,7 @@ order: 32 "label": "数字", "value": 111111, "prefix": "$", - "subfix": "%", + "suffix": "%", "kilobitSeparator": true } ] @@ -74,5 +74,5 @@ order: 32 | precision | `number` | | 精度,即小数点后几位 | | showSteps | `boolean` | | 是否显示上下点击按钮 | | prefix | `string` | | 前缀 | -| subfix | `string` | | 后缀 | +| suffix | `string` | | 后缀 | | kilobitSeparator | `boolean` | | 千分分隔 | diff --git a/src/renderers/Form/InputNumber.tsx b/src/renderers/Form/InputNumber.tsx index 948641105..b803f4d46 100644 --- a/src/renderers/Form/InputNumber.tsx +++ b/src/renderers/Form/InputNumber.tsx @@ -47,7 +47,7 @@ export interface NumberControlSchema extends FormBaseControl { /** * 后缀 */ - subfix?: string; + suffix?: string; /** * 是否千分分隔 */ @@ -71,7 +71,7 @@ export interface NumberProps extends FormControlProps { /** * 后缀 */ - subfix?: string; + suffix?: string; /** * 是否千分分隔 */ @@ -121,7 +121,7 @@ export default class NumberControl extends React.Component { placeholder, showSteps, borderMode, - subfix, + suffix, prefix, kilobitSeparator } = this.props; @@ -140,12 +140,12 @@ export default class NumberControl extends React.Component { } return (prefix ? prefix : '') + value - + (subfix ? subfix : ''); + + (suffix ? suffix : ''); } // 将数字还原 const parser = (value: string) => { prefix && (value = value.replace(prefix, '')); - subfix && (value = value.replace(subfix, '')); + suffix && (value = value.replace(suffix, '')); kilobitSeparator && (value = value.replace(/,/g, '')); return value; }