Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json 配置里如何获取父组建的数据 #33

Closed
hyschumi opened this issue May 15, 2019 · 5 comments
Closed

json 配置里如何获取父组建的数据 #33

hyschumi opened this issue May 15, 2019 · 5 comments

Comments

@hyschumi
Copy link

No description provided.

@2betop
Copy link
Collaborator

2betop commented May 15, 2019

你的问题是,怎么把数据传递给 amis 渲染器,还是说 amis 渲染器里面的组件间的数据获取?

如果是后者,按理直接就能取到,因为每一次层的数据的原型都执行了父级数据。

@hyschumi
Copy link
Author

hyschumi commented May 15, 2019

场景是这样的

{
    type: "crud",
    columns: [
     ....,
    // 外层A
    {
       type: "operation",
       buttons:[
          {
               type: "button",
               actionType: "dialog",
               dialog: {
                  body: {
                      type: 'crud',
                      columns: [
                        // 内层 B
                        {}
                      ]
                  }
               },
          }
       ],
     }
    ]
}

”内层B“的columns 内有办法获取到“外层A“中的数据吗 比如A的ID?

@2betop
Copy link
Collaborator

2betop commented May 15, 2019

自动的,默认行为

@hyschumi
Copy link
Author

外层 column A的数据item有id属性 但是内层column B 的API数据item有也包含id,这样配置column�B时怎么区分这两个ID呢?

@2betop
Copy link
Collaborator

2betop commented May 16, 2019

dialog 里面可以加个数据映射

"data": {
  "&": "$$", // 如果想保留原有数据,加这样,如果不需要,可以去掉。
  "parentId": "${id}"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants