react-jsonschema-form asynctypeahead URL参数取决于另一个选择框中的值

问题描述

我有一个要求,我们要有一个react-jsonschema-form-extras asyncTypeahead,如消息末尾的uischema中所示。我需要的是,当用户开始在asyncTypeahead字段中键入内容时,它可以获取所选选择框的值(在下面的我的架构中称为“类型”)值,并在asyncTypeahead的URL中使用它,即替换我的硬编码网址“ URL”中的“ 367”:URL_EXTERNAL_GET_FILTERED_DICTIONARY + 5 +“ /” + 367,

谁能告诉我我该怎么做?谢谢。

export const uischemajsonforms = {
"COMPOUND": {
    "Comments": {
        "ui:widget": "textarea","rows": 5
    },"BATCH": {
        "SAMPLE": {
            "Container": {
                "ui:field": "asyncTypeahead","asyncTypeahead": {
                    "url": URL_EXTERNAL_GET_FILTERED_DICTIONARY+ 5 + "/" + 367,"labelKey": RESERVED_FIELD_DICT_VALUE,"mapping": RESERVED_FIELD_ID,}}
            }
        }
    }

}

我的模式是:

export const schemajsonforms = {
"type": "object","properties": {
    "COMPOUND" : {
        "type": "object","properties": {
            "Comments": {
                "messages": false,"type": "string","minLength": 0,"maxLength":200
            },"BATCH" : {
                "type": "object","properties": {
                    "purity": {
                        "type": "number"
                    },"Barcode": {
                        "type": "string","maxLength":200
                    },"SAMPLE" : {
                        "type": "object","properties": {
                            "Amount": {
                                "type": "number"
                            },"Type": {
                                "type": "number","anyOf": [
                                    {
                                        "type": "number","title": "Default","enum": [
                                            367
                                        ]
                                    },{
                                        "type": "number","title": "Eppendorf","enum": [
                                            1929
                                        ]
                                    },"title": "Plate","enum": [
                                            1931
                                        ]
                                    },"title": "Bottle","enum": [
                                            366
                                        ]
                                    }
                                ],"default": "Default"
                            },"Container": {
                                "type": "string",}
                        }
                    }
                },"required": ["Type","Container"]
            }
        }
    }
}

}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)