使用react-jsonschema-form字段事件

时间:2018-11-06 07:03:03

标签: reactjs react-jsonschema-forms

我有一个简单的模式来生成表单。当鼠标悬停时,我想对字段执行一些操作。但我不知道如何将鼠标悬停在所有字段上。通过阅读Documents,我发现表单字段有一些事件。  -表单字段模糊事件  -表单领域焦点事件 尽管没有任何示例。请帮助我了解在哪里可以将鼠标悬停在事件上? 这是我的架构:

.unspecified

这是我用来显示生成的表单的组件:

 "schema":
         {
            "type":"object",
            "properties":{
                "request": {
                    "type": "object",
                    "properties": {
                        "requester": {
                            "type": "string"
                        },
                        "requestDate": {
                            "type": "integer"
                        },
                        "detailList": {
                            "type": "array",
                            "items": {
                                "id": "urn:jsonschema:com:fanap:demo:entity:ItemRequestDetail",
                                "type": "object",
                                "properties": {
                                    "item": {
                                        "id": "urn:jsonschema:com:fanap:demo:entity:ItemClass",
                                        "type": "object",
                                        "properties": {
                                            "name": {
                                                "type": "string"
                                            }
                                        }
                                    },
                                    "requestedAmount": {
                                        "type": "number"
                                    }
                                }
                            }
                        },
                        "description": {
                            "type": "string"
                        },
                        "state": {
                            "id": "urn:jsonschema:com:fanap:demo:entity:CategoryElement",
                            "type": "object",
                            "properties": {
                                "name": {
                                    "type": "string"
                                }
                            }
                        },
                    }
                },
                "processResult": {
                    "type": "object",
                    "properties": {
                        "notificationMessage": { "type": "string" }
                    }
                }
            }
         }

如何将鼠标悬停在所有元素上? 我非常感谢您可以提供的任何帮助。

1 个答案:

答案 0 :(得分:1)

可能是一个骇人听闻的解决方案,但是您可以利用Field Template来定义自定义事件,例如鼠标悬停时。如果可行,则必须定义一次,而不必在每个输入字段中重复一次