diff --git a/CHANGELOG.md b/CHANGELOG.md index 5148d16e2..efc64b52b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## 1.4.6 - 修复:` - - - - - - - - - - - + { + this.setState({ + position: data, + checkedIndex: index + }) + }} + /> +
+
+
+ + + + + + + + + +
) } @@ -83,21 +76,17 @@ render(){ render(){ return ( -
-
-
- - - - - - - - - -
-
-
+
+ + + + + + + + + +
) } ``` @@ -113,9 +102,7 @@ render(){ constructor(props) { super(props) - this.form = React.createRef() - this.state = { form: { name: '', @@ -127,8 +114,8 @@ constructor(props) { name: [ { required: true, - message: input name, - trigger: 'blur,change' + message: input name, + trigger: 'onBlur,onChange' } ], region: [ @@ -154,7 +141,7 @@ constructor(props) { cb() } }, - trigger: 'change' + trigger: 'onChange' } ] } @@ -192,28 +179,32 @@ render(){ const {form, checkedIndex} = this.state return ( -
-
-
- - - - - - - - - - - - -
-
-
+
+ + + + + + + + + + + + +
) } ``` diff --git a/docs/zh-CN/components/form.md b/docs/zh-CN/components/form.md index ec501840b..e51af290f 100644 --- a/docs/zh-CN/components/form.md +++ b/docs/zh-CN/components/form.md @@ -7,7 +7,6 @@ ```js constructor() { super() - this.state = { alignCheckedIndex: 0, alignList: [ @@ -45,14 +44,13 @@ constructor() { } render(){ - const {position, alignCheckedIndex, columnCheckedIndex} = this.state + const { position, alignCheckedIndex, columnCheckedIndex } = this.state const Row = Grid.Row const Col = Grid.Col return (
- - - - -
- - + + - - - + + - - + -
@@ -114,21 +105,17 @@ render(){ ```js render(){ return ( -
-
-
- - - - - - - - - -
-
-
+
+ + + + + + + + + +
) } ``` @@ -155,7 +142,7 @@ constructor(props) { name: [ { required: true, - message: 请输入名称, + message: 请输入名称, trigger: 'onBlur,onChange' } ], @@ -207,7 +194,8 @@ cancelSubmit() { form: { name: '', region: '', - count: '' + count: '', + type: [] } }) this.form.resetValidates() @@ -228,36 +216,37 @@ handleChange(key, e, value, index) { render(){ const Row = Grid.Row const Col = Grid.Col - const {form, checkedIndex} = this.state - + const {form} = this.state return ( -
+
this.form = node} model={form} rules={this.state.rules} labelWidth='80'> - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + +
-
+ ) } ``` @@ -287,8 +276,8 @@ render(){ ### Form Methods -| 方法名| 说明| -| --- | --- | -| validate(callback) | 对整个表单进行校验 | -| validateField(prop, callback) | 对表单字段进行校验 | -| resetValidates | 重置整个表单的验证 | +| 方法名 | 说明 | 回调参数 | +| ----------------------------- | ------------------ | ---------------------------------------- | +| validate(callback) | 对整个表单进行校验 | (valid: boolean) => void | +| validateField(prop, callback) | 对表单字段进行校验 | (prop: string, (valid: boolean) => void) | +| resetValidates() | 重置整个表单的验证 | - |