fix whitespace required, close #5418

This commit is contained in:
afc163 2017-03-21 15:21:40 +08:00
parent 847515be3d
commit 93ec71ea58
3 changed files with 3 additions and 1 deletions

View File

@ -164,7 +164,7 @@ class RegistrationForm extends React.Component {
hasFeedback hasFeedback
> >
{getFieldDecorator('nickname', { {getFieldDecorator('nickname', {
rules: [{ required: true, message: 'Please input your nickname!' }], rules: [{ required: true, message: 'Please input your nickname!', whitespace: true }],
})( })(
<Input /> <Input />
)} )}

View File

@ -133,6 +133,7 @@ Property | Description | Type | Default Value
message | validation error message | string | - message | validation error message | string | -
type | built-in validation type, [available options](https://github.com/yiminghe/async-validator#type) | string | 'string' type | built-in validation type, [available options](https://github.com/yiminghe/async-validator#type) | string | 'string'
required | indicates whether field is required | boolean | `false` required | indicates whether field is required | boolean | `false`
whitespace | treat required fields that only contain whitespace as errors | boolean | `false`
len | validate an exact length of a field | number | - len | validate an exact length of a field | number | -
min | validate a min length of a field | number | - min | validate a min length of a field | number | -
max | validate a max length of a field | number | - max | validate a max length of a field | number | -

View File

@ -134,6 +134,7 @@ CustomizedForm = Form.create({})(CustomizedForm);
message | 校验文案 | string | - message | 校验文案 | string | -
type | 内建校验类型,[可选项](https://github.com/yiminghe/async-validator#type) | string | 'string' type | 内建校验类型,[可选项](https://github.com/yiminghe/async-validator#type) | string | 'string'
required | 是否必选 | boolean | `false` required | 是否必选 | boolean | `false`
whitespace | 必选时,空格是否会被视为错误 | boolean | `false`
len | 字段长度 | number | - len | 字段长度 | number | -
min | 最小长度 | number | - min | 最小长度 | number | -
max | 最大长度 | number | - max | 最大长度 | number | -