From b837423b6b425e50e1409235053c1e778aa1cde0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8C=97=E6=B5=B7=E4=B8=80=E5=88=80?= <849005670@qq.com> Date: Thu, 11 Nov 2021 18:05:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/form/main.js | 6 ++---- src/components/input/main.js | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/form/main.js b/src/components/form/main.js index f0d1be17..c383c365 100644 --- a/src/components/form/main.js +++ b/src/components/form/main.js @@ -39,7 +39,7 @@ export default class form extends React.Component { let closebtn = input_compontent[0].parentNode.children[1]; if (closebtn) { closebtn.onclick = function(e) { - self.removeClasss(item) + self.removeClasss(item) self.isRequired(formItem_com.value, o.className, item, rules_item[i].message); } } @@ -155,6 +155,7 @@ export default class form extends React.Component { validator() { console.log("表单验证") + console.log(this.props.model) let doms = document.getElementsByClassName("form-Item"); let self = this; for (let i = 0; i < doms.length; i++) { @@ -168,8 +169,6 @@ export default class form extends React.Component { let rules_item = _.get(this.state.rules, formItem.props.prop) if (rules_item) { for (let j = 0; j < rules_item.length; j++) { - - if (rules_item[j].type == "required") { console.log("当前值") console.log(formItem_com.value) @@ -182,7 +181,6 @@ export default class form extends React.Component { else{ self.removeClasss(item) } - } if (rules_item[j].type == "regExp") { diff --git a/src/components/input/main.js b/src/components/input/main.js index 77da6daf..f432bd84 100644 --- a/src/components/input/main.js +++ b/src/components/input/main.js @@ -83,6 +83,7 @@ import classNames from 'classnames' clearItem(){ this.setState({iptVal:''}); this.setState({iptVallength:0}); + this.props.onClearItem(); } // 焦点事件,伸展宽度 focusFn(e){