问题描述
我正在尝试使用react-jsonschema-form,我需要做一些依赖,我遇到的问题如下。 有条件地呈现的字段被添加到表单的末尾,而不是在调用该条件的字段之后。
{
"title": "Person","type": "object","properties": {
"Do you have any pets?": {
"type": "string","enum": [
"No","Yes: One","Yes: More than one"
],"default": "No"
},"Test?": {
"type": "string"
}
},"required": [
"Do you have any pets?"
],"dependencies": {
"Do you have any pets?": {
"oneOf": [
{
"properties": {
"Do you have any pets?": {
"enum": [
"No"
]
}
}
},{
"properties": {
"Do you have any pets?": {
"enum": [
"Yes: One"
]
},"How old is your pet?": {
"type": "number"
}
},"required": [
"How old is your pet?"
]
},{
"properties": {
"Do you have any pets?": {
"enum": [
"Yes: More than one"
]
},"Do you want to get rid of any?": {
"type": "boolean"
}
},"required": [
"Do you want to get rid of any?"
]
}
]
}
}
}
但我认为应该在依赖字段之后添加。
沙盒https://rjsf-team.github.io/react-jsonschema-form/
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)