From c29f22fe7239b8c01ee875dd98655e3bc1e03683 Mon Sep 17 00:00:00 2001 From: valleykid Date: Thu, 18 Jan 2018 18:43:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DTableList=E9=AA=8C=E8=AF=81?= =?UTF-8?q?=E8=AF=AF=E8=A7=A6=E5=8F=91=20(#756)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add *bak in gitignore * 修复TableList表单验证误触发问题 fix #755 --- .gitignore | 1 + src/routes/List/TableList.js | 55 +++++++++++++++++++++++++++--------- 2 files changed, 42 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index bdba67fc..aa3fce58 100755 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,5 @@ yarn-error.log .idea yarn.lock package-lock.json +*bak jsconfig.json diff --git a/src/routes/List/TableList.js b/src/routes/List/TableList.js index 2cc07775..54577f02 100644 --- a/src/routes/List/TableList.js +++ b/src/routes/List/TableList.js @@ -10,6 +10,36 @@ const FormItem = Form.Item; const { Option } = Select; const getValue = obj => Object.keys(obj).map(key => obj[key]).join(','); +const CreateForm = Form.create()((props) => { + const { modalVisible, addInputValue, parent, form } = props; + const okHandle = () => { + form.validateFields((err/* , fieldsValue */) => { + if (err) return; + parent.handleAdd(); + }); + }; + return ( + parent.handleModalVisible()} + > + + {form.getFieldDecorator('desc', { + rules: [{ required: true, message: 'Please input some description...' }], + })( + + )} + + + ); +}); + @connect(({ rule, loading }) => ({ rule, loading: loading.models.rule, @@ -279,6 +309,12 @@ export default class TableList extends PureComponent { ); + const parentMethods = { + handleAdd: this.handleAdd, + handleModalVisible: this.handleModalVisible, + handleAddInput: this.handleAddInput, + }; + return ( @@ -312,20 +348,11 @@ export default class TableList extends PureComponent { /> - this.handleModalVisible()} - > - - - - + ); } -- GitLab