8000 自定义组件中给其他组件setValue · Issue #12121 · baidu/amis · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
自定义组件中给其他组件setValue #12121
Open
@zqinshade

Description

@zqinshade
{
  "type": "page",
  "title": "更新筛选器数据",
  "data": {
    "globalData": {
      "myrole": "法官",
      "mymsg": "该吃饭了!",
      "age": "20"
    }
  },
  "body": [
    {
      "type": "button",
      "label": "更新",
      "level": "primary",
      "className": "mb-2",
      "onEvent": {
        "click": {
          "actions": [
            {
              "actionType": "setValue",
              "componentId": "crud_data",
              "args": {
                "value": {
                  "myrole": "${globalData.myrole}",
                  "age": "${globalData.age}"
                }
              }
            }
          ]
        }
      }
    },
    {
      "type": "crud",
      "id": "crud_data",
      "syncLocation": false,
      "title": "数据表格",
      "debug": true,
      "api": {
        "method": "get",
        "url": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/initData"
      },
      "filter": {
        "title": "筛选条件",
        "mode": "horizontal",
        "body": [
          {
            "type": "input-text",
            "label": "角色",
            "name": "myrole"
          },
          {
            "type": "input-text",
            "label": "年龄",
            "name": "age"
          },
          {
            "type": "submit",
            "label": "搜索",
            "level": "primary"
          }
        ]
      },
      "columns": [
        {
          "name": "myrole",
          "label": "角色",
          "type": "text"
        },
        {
          "name": "age",
          "label": "年龄",
          "type": "text"
        }
      ]
    }
  ]
}

上面的代码点击更新后可以把crud中的filter的值更新

现在想使用一个自定义组件去更新crud中filter的值

目前自定义组件中setValue代码是这样的

this.props.onAction(
      event,
      {
        actionType: 'setValue',
        componentId: 'ik-crud',
        type: 'action',
      },
      {
        args: {
          value: {
            uid: record.uid,
          },
        }
      }
    );

但是没有成功,想问下怎么修改

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0