Browse Source

docs: update demo order

pull/3658/head
Benjy Cui 8 years ago
parent
commit
037d739fa4
  1. 2
      components/form/demo/customized-form-controls.md
  2. 33
      components/form/demo/dynamic-form-item.md
  3. 2
      components/form/demo/mix.md
  4. 2
      components/form/demo/register.md
  5. 2
      components/form/demo/time-related-controls.md
  6. 2
      components/form/demo/validate-other.md
  7. 2
      components/form/demo/validate-static.md

2
components/form/demo/customized-form-controls.md

@ -1,5 +1,5 @@
---
order: 6
order: 7
title:
zh-CN: 自定义表单控件
en-US: Customized Form Controls

33
components/form/demo/dynamic-form-item.md

@ -1,8 +1,8 @@
---
order: 10
order: 5
title:
zh-CN: 动态增减表单项
en-US: Dynamic form item
en-US: Dynamic Form Item
---
## zh-CN
@ -26,34 +26,36 @@ let Demo = React.createClass({
remove(k) {
const { form } = this.props;
// can use data-binding to get
let keys = form.getFieldValue('keys');
keys = keys.filter((key) => {
const keys = form.getFieldValue('keys');
const nextKeys = keys.filter((key) => {
return key !== k;
});
// can use data-binding to set
form.setFieldsValue({
keys,
keys: nextKeys,
});
},
add() {
uuid++;
const { form } = this.props;
// can use data-binding to get
let keys = form.getFieldValue('keys');
keys = keys.concat(uuid);
const keys = form.getFieldValue('keys');
const nextKeys = keys.concat(uuid);
// can use data-binding to set
// important! notify form to detect changes
form.setFieldsValue({
keys,
keys: nextKeys,
});
},
submit(e) {
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((errors, values) => {
if (errors) {
console.log(errors);
this.props.form.validateFields((err, values) => {
if (err) {
return;
}
console.log(values);
console.log('Received values of form: ', values);
});
},
render() {
@ -81,11 +83,11 @@ let Demo = React.createClass({
);
});
return (
<Form horizontal>
<Form horizontal onSubmit={this.handleSubmit}>
{formItems}
<Form.Item wrapperCol={{ span: 18, offset: 6 }}>
<Button onClick={this.add} style={{ marginRight: 8 }}>add good friend</Button>
<Button type="primary" onClick={this.submit}>submit</Button>
<Button type="primary" htmlType="submit">submit</Button>
</Form.Item>
</Form>
);
@ -93,6 +95,5 @@ let Demo = React.createClass({
});
Demo = Form.create()(Demo);
ReactDOM.render(<Demo />, mountNode);
````

2
components/form/demo/mix.md

@ -1,5 +1,5 @@
---
order: 7
order: 8
title:
zh-CN: 表单组合
en-US: Mix

2
components/form/demo/register.md

@ -51,7 +51,7 @@ const RegistrationForm = Form.create()(React.createClass({
handleSubmit(e) {
e.preventDefault();
this.props.form.validateFields((err, values) => {
this.props.form.validateFieldsAndScroll((err, values) => {
if (err) {
return;
}

2
components/form/demo/time-related-controls.md

@ -1,5 +1,5 @@
---
order: 5
order: 6
title:
zh-CN: 时间类控件
en-US: Time-related Controls

2
components/form/demo/validate-other.md

@ -1,5 +1,5 @@
---
order: 9
order: 10
title:
zh-CN: 校验其他组件
en-US: Others components related to validation

2
components/form/demo/validate-static.md

@ -1,5 +1,5 @@
---
order: 8
order: 9
title:
zh-CN: 校验提示
en-US: Validation message

Loading…
Cancel
Save