baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.11k stars 2.48k forks source link

CURD itemAction无法获取上层data数据 #4663

Open haoke016 opened 2 years ago

haoke016 commented 2 years ago

描述问题:

CURD itemAction无法获取上层data数据

截图或视频:

image ItemAction: image 单元格弹框: image

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的? sdknpm其他...

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在 官网案例https://aisuda.bce.baidu.com/amis/zh-CN/components/table

  3. 粘贴有问题的完整 amis schema 代码:

    {
    "type": "page",
    "body": {
    "type": "service",
    "data": {
      "data1": "测试数据"
    },
    "api": "/amis/api/mock2/sample?perPage=10",
    "body": [
      {
        "type": "table",
        "source": "$rows",
        "itemAction": {
          "type": "button",
          "actionType": "dialog",
          "dialog": {
            "title": "详情",
            "body": "当前行的数据 ${data1} browser: ${browser}, version: ${version}"
          }
        },
        "columns": [
          {
            "name": "browser",
            "label": "Browser"
          },
          {
            "name": "version",
            "label": "Version"
          },
          {
            "type": "button",
            "label": "一个弹框",
            "actionType": "dialog",
            "dialog": {
              "title": "一个弹框",
              "body": [
                {
                  "type": "tpl",
                  "tpl": "当前行的数据 ${data1} browser: ${browser}, version: ${version}"
                }
              ]
            }
          }
        ]
      }
    ]
    }
    }
  4. 操作步骤 请简单描述一下复现的操作步骤...

lurunze1226 commented 2 years ago

itemAction 所在的数据域是Table Row,所以它只能拿到当前行的数据

haoke016 commented 2 years ago

建议和单元格弹框保持一致,否则展示或修改的option映射选项好得加载一次

eddyzhang1986 commented 1 year ago

主要是这个配置也不支持event.data和dialog中的data映射