fix:number后缀单词修改为suffix (#2400)

Co-authored-by: qinhaoyan <qinhaoyan@baidu.com>
This commit is contained in:
qinhaoyan 2021-08-18 15:00:04 +08:00 committed by GitHub
parent 84f33dc566
commit fc6ad1d0c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -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` | | 千分分隔 |

View File

@ -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<NumberProps, any> {
placeholder,
showSteps,
borderMode,
subfix,
suffix,
prefix,
kilobitSeparator
} = this.props;
@ -140,12 +140,12 @@ export default class NumberControl extends React.Component<NumberProps, any> {
}
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;
}