添加动态验证规则-Redux-Form

时间:2018-07-20 12:53:53

标签: reactjs react-native redux redux-form

我想使用redux-form动态生成验证规则,我有一个对象,可以使用包含该字段及其验证规则的Web服务检索该对象,这是我要恢复的一些字段。

[
 {
    "id": 1,
    "title": "Car",
    "description": "",
    "fields": [
        {
            "label": "registration",
            "name": "registration",
            "type": "text",
            "checkRules": {
                "required": true,
                "minLength": 5,
                "maxLength": 11
            }
        }],
 }
]

所以我有一个checkRules对象,其中包含不同的验证

我认为现场验证是正确的方法=> https://redux-form.com/6.6.3/examples/fieldlevelvalidation/

我看不到如何做的是生成about验证表,但是我想动态地修改他们的示例。

0 个答案:

没有答案