diff --git a/components/form/__tests__/__snapshots__/demo.test.js.snap b/components/form/__tests__/__snapshots__/demo.test.js.snap index 6bda35982d..cf427350d6 100644 --- a/components/form/__tests__/__snapshots__/demo.test.js.snap +++ b/components/form/__tests__/__snapshots__/demo.test.js.snap @@ -1070,7 +1070,7 @@ exports[`renders ./components/form/demo/horizontal-login.md correctly 1`] = ` class="ant-input" data-__field="[object Object]" data-__meta="[object Object]" - id="horizontal_login_userName" + id="horizontal_login_username" placeholder="Username" type="text" value="" @@ -1392,7 +1392,7 @@ exports[`renders ./components/form/demo/normal-login.md correctly 1`] = ` class="ant-input" data-__field="[object Object]" data-__meta="[object Object]" - id="normal_login_userName" + id="normal_login_username" placeholder="Username" type="text" value="" diff --git a/components/form/demo/horizontal-login.md b/components/form/demo/horizontal-login.md index 88622a03b8..4b612a6931 100644 --- a/components/form/demo/horizontal-login.md +++ b/components/form/demo/horizontal-login.md @@ -43,15 +43,15 @@ class HorizontalLoginForm extends React.Component { } = this.props.form; // Only show error after a field is touched. - const userNameError = isFieldTouched('userName') && getFieldError('userName'); + const usernameError = isFieldTouched('username') && getFieldError('username'); const passwordError = isFieldTouched('password') && getFieldError('password'); return (
- {getFieldDecorator('userName', { + {getFieldDecorator('username', { rules: [{ required: true, message: 'Please input your username!' }], })( } placeholder="Username" /> diff --git a/components/form/demo/normal-login.md b/components/form/demo/normal-login.md index b7a9ac5fcd..c686d776b9 100644 --- a/components/form/demo/normal-login.md +++ b/components/form/demo/normal-login.md @@ -33,7 +33,7 @@ class NormalLoginForm extends React.Component { return ( - {getFieldDecorator('userName', { + {getFieldDecorator('username', { rules: [{ required: true, message: 'Please input your username!' }], })( } placeholder="Username" /> diff --git a/components/form/index.en-US.md b/components/form/index.en-US.md index 0b9dd0a34a..3bd2bf6653 100644 --- a/components/form/index.en-US.md +++ b/components/form/index.en-US.md @@ -127,11 +127,11 @@ validateFields(['field1', 'field2'], options, (errors, values) => { ```js { - "userName": { + "username": { "errors": [ { "message": "Please input your username!", - "field": "userName" + "field": "username" } ] }, @@ -150,7 +150,7 @@ validateFields(['field1', 'field2'], options, (errors, values) => { ```js { - "userName": "username", + "username": "username", "password": "password", } ``` diff --git a/components/form/index.zh-CN.md b/components/form/index.zh-CN.md index 0d54882e53..7362ca74ee 100644 --- a/components/form/index.zh-CN.md +++ b/components/form/index.zh-CN.md @@ -129,11 +129,11 @@ validateFields(['field1', 'field2'], options, (errors, values) => { ```js { - "userName": { + "username": { "errors": [ { "message": "Please input your username!", - "field": "userName" + "field": "username" } ] }, @@ -152,7 +152,7 @@ validateFields(['field1', 'field2'], options, (errors, values) => { ```js { - "userName": "username", + "username": "username", "password": "password", } ```