mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 03:48:13 +08:00
fix:number后缀单词修改为suffix (#2400)
Co-authored-by: qinhaoyan <qinhaoyan@baidu.com>
This commit is contained in:
parent
84f33dc566
commit
fc6ad1d0c9
@ -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` | | 千分分隔 |
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user