ant-design/components/input-number/demo/formatter.md
2017-03-16 16:59:06 +08:00

532 B

order title
4
zh-CN en-US
格式化展示 Formatter

zh-CN

展示具有具体含义的数据。

en-US

Display value within it's situation.

import { InputNumber } from 'antd';

function onChange(value) {
  console.log('changed', value);
}

ReactDOM.render(
  <div>
    <InputNumber formatter={value => `$ ${value}`} defaultValue={100} onChange={onChange} />
    <InputNumber formatter={value => `${value.replace('%', '')}%`} defaultValue={100} onChange={onChange} />
  </div>
, mountNode);