designable icon indicating copy to clipboard operation
designable copied to clipboard

在表格的响应式配置dataSource,表格数据还是显示no data,下面是我在设计器里的schema json

Open yexianli opened this issue 2 years ago • 2 comments

{ "form": { "labelCol": 6, "wrapperCol": 12, "wrapperWidth": "300px" }, "schema": { "type": "object", "properties": { "valiNumber": { "type": "number", "title": "NumberPicker4", "x-decorator": "FormItem", "x-component": "NumberPicker", "x-validator": [], "x-component-props": {}, "x-decorator-props": {}, "name": "valiNumber", "default": 9, "x-designable-id": "kv4ilfmqh7k", "x-index": 0 }, "valiInput": { "type": "string", "title": "Input", "x-decorator": "FormItem", "x-component": "Input", "x-validator": [], "x-component-props": {}, "x-decorator-props": {}, "name": "valiInput", "x-reactions": { "dependencies": [ { "property": "value", "type": "any", "source": "valiNumber", "name": "valiNumber" } ], "fulfill": { "state": { "visible": "{{$deps.valiNumber === 9}}", "componentProps": "{{\r\n\r\n{\r\n placeholder: "This is placeholder vali"\r\n}}}" }, "run": "$effect(() => {\n $self.loading = true\n setTimeout(() => {\n $self.loading = false\n $self.initialValue = "vali 6666"\n }, 5000)\n}, [])\n" } }, "x-designable-id": "1psnlu4ll0p", "x-index": 1 }, "bnprispnad4": { "type": "array", "x-decorator": "FormItem", "x-component": "ArrayTable", "x-validator": [], "x-component-props": { "bordered": true, "showHeader": false }, "x-decorator-props": {}, "x-reactions": { "dependencies": [ { "property": "value", "type": "any" } ], "fulfill": { "run": "$effect(() => {\n console.log('表格数据配置')\n $self.dataSource = [\n {\n key: "1",\n name: "胡彦斌",\n age: 32,\n address: "西湖区湖底公园1号",\n },\n {\n key: "2",\n name: "胡彦祖",\n age: 42,\n address: "西湖区湖底公园1号",\n },\n ]\n}, [])\n", "state": {} } }, "x-designable-id": "bnprispnad4", "x-index": 2, "title": "", "items": { "type": "object", "x-designable-id": "iea4gx9mj5z", "x-validator": [], "properties": { "l9uxi4hwtgo": { "type": "void", "x-component": "ArrayTable.Column", "x-component-props": { "title": "Title" }, "x-designable-id": "l9uxi4hwtgo", "x-index": 0, "properties": { "zvppfdm5g6g": { "type": "void", "x-component": "ArrayTable.Remove", "x-designable-id": "zvppfdm5g6g", "x-index": 0 }, "xshb3b8tsrk": { "type": "void", "x-component": "ArrayTable.MoveDown", "x-designable-id": "xshb3b8tsrk", "x-index": 1 }, "jbs8uknrktf": { "type": "void", "x-component": "ArrayTable.MoveUp", "x-designable-id": "jbs8uknrktf", "x-index": 2 } } } } }, "properties": { "8hve1high7k": { "type": "void", "title": "Addition", "x-component": "ArrayTable.Addition", "x-designable-id": "8hve1high7k", "x-index": 0 } } } }, "x-designable-id": "7b4fjaf3r4c" } }

yexianli avatar Apr 08 '22 03:04 yexianli

根据我的经验,表格的数据要设置 $self.value,设置 $self.dataSource 不生效

修改后
{
  "form": {
    "labelCol": 6,
    "wrapperCol": 12,
    "wrapperWidth": "300px"
  },
  "schema": {
    "type": "object",
    "properties": {
      "valiNumber": {
        "type": "number",
        "title": "NumberPicker4",
        "x-decorator": "FormItem",
        "x-component": "NumberPicker",
        "x-validator": [],
        "x-component-props": {},
        "x-decorator-props": {},
        "name": "valiNumber",
        "default": 9,
        "x-designable-id": "kv4ilfmqh7k",
        "x-index": 0
      },
      "valiInput": {
        "type": "string",
        "title": "Input",
        "x-decorator": "FormItem",
        "x-component": "Input",
        "x-validator": [],
        "x-component-props": {},
        "x-decorator-props": {},
        "name": "valiInput",
        "x-reactions": {
          "dependencies": [
            {
              "property": "value",
              "type": "any",
              "source": "valiNumber",
              "name": "valiNumber"
            }
          ],
          "fulfill": {
            "state": {
              "visible": "{{$deps.valiNumber === 9}}",
              "componentProps": "{{\r\n\r\n{\r\n placeholder: \"This is placeholder vali\"\r\n}}}"
            },
            "run": "$effect(() => {\n $self.loading = true\n setTimeout(() => {\n $self.loading = false\n $self.initialValue = \"vali 6666\"\n }, 5000)\n}, [])\n"
          }
        },
        "x-designable-id": "1psnlu4ll0p",
        "x-index": 1
      },
      "bnprispnad4": {
        "type": "array",
        "x-decorator": "FormItem",
        "x-component": "ArrayTable",
        "x-validator": [],
        "x-component-props": {
          "bordered": true,
          "showHeader": false
        },
        "x-decorator-props": {},
        "x-reactions": {
          "dependencies": [
            {
              "property": "value",
              "type": "any"
            }
          ],
          "fulfill": {
            "run": "$effect(() => {\n  console.log(\"表格数据配置\")\n  $self.value = [\n    {\n      key: \"1\",\n      name: \"胡彦斌\",\n      age: 32,\n      address: \"西湖区湖底公园1号\",\n    },\n    {\n      key: \"2\",\n      name: \"胡彦祖\",\n      age: 42,\n      address: \"西湖区湖底公园1号\",\n    },\n  ]\n}, [])\n",
            "state": {}
          }
        },
        "x-designable-id": "bnprispnad4",
        "x-index": 2,
        "title": "",
        "items": {
          "type": "object",
          "x-designable-id": "iea4gx9mj5z",
          "x-validator": [],
          "properties": {
            "l9uxi4hwtgo": {
              "type": "void",
              "x-component": "ArrayTable.Column",
              "x-component-props": {
                "title": "Title"
              },
              "x-designable-id": "l9uxi4hwtgo",
              "x-index": 0,
              "properties": {
                "zvppfdm5g6g": {
                  "type": "void",
                  "x-component": "ArrayTable.Remove",
                  "x-designable-id": "zvppfdm5g6g",
                  "x-index": 0
                },
                "xshb3b8tsrk": {
                  "type": "void",
                  "x-component": "ArrayTable.MoveDown",
                  "x-designable-id": "xshb3b8tsrk",
                  "x-index": 1
                },
                "jbs8uknrktf": {
                  "type": "void",
                  "x-component": "ArrayTable.MoveUp",
                  "x-designable-id": "jbs8uknrktf",
                  "x-index": 2
                }
              }
            }
          }
        },
        "properties": {
          "8hve1high7k": {
            "type": "void",
            "title": "Addition",
            "x-component": "ArrayTable.Addition",
            "x-designable-id": "8hve1high7k",
            "x-index": 0,
            "x-component-props": {}
          }
        }
      }
    },
    "x-designable-id": "npdbkuk8buy"
  }
}

zjffun avatar May 14 '22 09:05 zjffun

{ "form": { "labelCol": 6, "wrapperCol": 12 }, "schema": { "type": "object", "properties": { "4h92mb9m701": { "type": "array", "x-decorator": "FormItem", "x-component": "ArrayTable", "x-validator": [], "x-component-props": { "pagination": { "pageSize": 15 }, "scroll": { "y": 200 } }, "x-decorator-props": {}, "default": "{{[{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'},{name:'1',code:'1'}]}}", "x-designable-id": "4h92mb9m701", "x-index": 0, "items": { "type": "object", "x-designable-id": "x9bzs4cejwk", "properties": { "0tarqq8l4x7": { "type": "void", "x-component": "ArrayTable.Column", "x-component-props": { "title": "Title" }, "title": "Title", "x-designable-id": "0tarqq8l4x7", "x-index": 0, "properties": { "name": { "type": "string", "x-component": "Text", "x-component-props": {}, "name": "name", "x-designable-id": "zows8jkf1rg", "x-index": 0 } } }, "tg5fjxzoawi": { "type": "void", "x-component": "ArrayTable.Column", "x-component-props": { "title": "Title" }, "x-designable-id": "tg5fjxzoawi", "x-index": 1, "properties": { "code": { "type": "string", "x-component": "Text", "x-component-props": {}, "name": "code", "x-designable-id": "yhhrls5h374", "x-index": 0 } } } } } } }, "x-designable-id": "cq6s2gyschg" } }

yaximi111 avatar Jul 15 '22 02:07 yaximi111