我正在尝试添加新的验证规则。我使用的是react-material 1.0
下面是我用来添加新规则但出错的代码
ValidatorForm.addValidationRule('isCanRequired', (value) => {
if(this.state.canSameAccount){
if(value==null || value==="" || value===undefined)
return false;
}
return true;
});下面是我添加此新规则的字段
<TextValidator fullWidth name="canAddress1" value={this.state.canAddress1}
validators={['isCanRequired']} errorMessages={['Please enter your street address 1']}
label="Enter Street Address 1*" onChange={this.handleChange('canAddress1')} />这是我单击submit按钮时的错误屏幕截图

发布于 2017-11-22 13:32:46
我得到了答案,因为react-material-ui-form-validator的测试版。需要更改ValidatorForm的包
import {ValidatorForm} from 'react-material-ui-form-validator'https://stackoverflow.com/questions/47406412
复制相似问题