alibaba / x-render

🚴‍♀️ 阿里 - 很易用的中后台「表单 / 表格 / 图表」解决方案
https://xrender.fun
6.99k stars 989 forks source link

列表嵌套类型的schema,在playground中测试没问题,但通过form-render渲染后的页面操作有问题。 #1332

Closed GoRolo closed 1 year ago

GoRolo commented 1 year ago
  1. 业务场景描述:有一个任务列表,里面可以配置不同的任务,其中包含分享任务,分享任务可以配置多种分享类型,不同的分享类型需要填写的字段不同,所以希望通过rootValue的形式来控制不同字段的展示和隐藏。
  2. 发现的问题:写好的schema通过playground测试,是符合上述业务逻辑的,但是通过form-render渲染后,存在判断不生效、新增一条数据后,之前填写的内容被清空的情况,不符合预期
  3. schema如下
    {
    "type": "object",
    "properties": {
    "fr-a5u7": {
      "title": "任务列表",
      "description": "",
      "type": "array",
      "items": {
        "title": "任务",
        "description": "",
        "column": 1,
        "type": "object",
        "widget": "card",
        "properties": {
          "ruleType": {
            "title": "任务类型",
            "type": "string",
            "props": {
              "options": [
                {
                  "label": "分享任务",
                  "value": "share"
                },
                {
                  "label": "购课",
                  "value": "buy"
                }
              ],
              "placeholder": "请选择"
            },
            "span": 24,
            "widget": "select"
          },
          "fr-azfz": {
            "title": "分享渠道",
            "description": "",
            "type": "array",
            "hidden": "{{rootValue.ruleType === 'buy'}}",
            "items": {
              "title": "分享渠道",
              "description": "",
              "column": 1,
              "type": "object",
              "widget": "card",
              "properties": {
                "shareType": {
                  "title": "分享类型",
                  "type": "string",
                  "props": {
                    "options": [
                      {
                        "label": "微信卡片",
                        "value": "1"
                      },
                      {
                        "label": "小程序",
                        "value": "2"
                      }
                    ],
                    "placeholder": "请选择"
                  },
                  "widget": "select"
                },
                "fr-1eca": {
                  "title": "小程序ID",
                  "type": "string",
                  "widget": "input",
                  "hidden": "{{rootValue.shareType === '1'}}"
                },
                "fr-7qk6": {
                  "title": "分享缩略图",
                  "widget": "imageInput",
                  "hidden": "{{rootValue.shareType === '2'}}"
                }
              }
            },
            "widget": "cardList",
            "labelCol": {
              "span": 4
            },
            "wrapperCol": {
              "span": 6
            }
          }
        }
      },
      "widget": "cardList",
      "labelCol": {
        "span": 4
      },
      "wrapperCol": {
        "span": 6
      }
    }
    },
    "displayType": "row",
    "maxWidth": "340px"
    }
lhbxs commented 1 year ago

具体是什么判断不生效

GoRolo commented 1 year ago

具体是什么判断不生效

schema中【分享类型】选择和【小程序ID】、【分享缩略图】这三个字段通过form-render渲染后的关联判断不生效,通过playground测试是没问题的

lhbxs commented 1 year ago

已修复,2.2.13

GoRolo commented 1 year ago

2.2.13

修复了,感谢大佬