Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何以数组中的对象作为条件使用Json表单中的规则?_Javascript_Reactjs_Jsonforms - Fatal编程技术网

Javascript 如何以数组中的对象作为条件使用Json表单中的规则?

Javascript 如何以数组中的对象作为条件使用Json表单中的规则?,javascript,reactjs,jsonforms,Javascript,Reactjs,Jsonforms,我将json表单与react一起使用,我想介绍隐藏类别的条件,它将根据数组中的对象显示 这里是伪模式 var schema = { "type": "object", "properties": { "name": { "type": "string" }, "alive": { "type": "array", "items": {

我将json表单与react一起使用,我想介绍隐藏类别的条件,它将根据数组中的对象显示

这里是伪模式

       var schema = {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "alive": {
          "type": "array",
          "items": {
                "type": "boolean"
            }
        },
        "kindOfDead": {
          "type": "string",
          "enum": [
            "Zombie",
            "Vampire",
            "Ghoul"
          ]
        }
      }
    }



    var uiSchema = {
      "type": "Categorization",
      "elements": [
        {
          "type": "Category",
          "label": "Private",
          "elements": [
            {
          "type": "Control",
          "label": "Name",
          "scope": "#/properties/name"
            }
          ]
        },
        {
          "type": "Category",
          "label": "public",
"rule": {
            "effect": "DISABLE",
            "condition": {
              "scope": "#/properties/alive",
              "schema": {
                "kindOfDead": true
              }
            }
          },
          "elements": [
            {
          "type": "Control",
          "label": "Kind of dead",
          "scope": "#/properties/kindOfDead"
        }
          ]
        }
      ]
    }

    var data = {
      "name": "John Doe",
      "alive": [
          isZombie:true,
      ],
        "kindOfDead": "Zombie"
    }
因此,在这种情况下,根据isZombie值,该选项卡应被禁用或启用。 isZombie的值由预发送的数据或用户提供