Skip to content

Commit

Permalink
Merge pull request #11130 from hsm-lv/fix-crud-ctx
Browse files Browse the repository at this point in the history
fix:补充crud批量操作中事件动作数据
  • Loading branch information
allenve authored Oct 29, 2024
2 parents 2298198 + 10fc793 commit 5f158ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/zh-CN/components/crud.md
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,7 @@ interface CRUDMatchFunc {
| `items` | `Array<Column>` | 批量操作 | `selectedItems` 的别名 |
| `rows` | `Array<Column>` | 批量操作 | `selectedItems` 的别名,推荐用 `items` |
| `ids` | `string` | 批量操作 | 多个 id 值用英文逗号隔开,前提是行数据中有 id 字段,或者有指定的 `primaryField` 字段 |
| `event` | `object` | 事件动作 | 可以通过`event.data`获取批量操作按钮上绑定的事件动作产生的数据 |
| `...rest` | `Record<string, any>` | 批量操作 | 选中的行数据集合的首个元素的字段,注意列字段如果和以上字段重名时,会被上述字段值覆盖 |

你可以通过[数据映射](../../docs/concepts/data-mapping),在`api`中获取这些参数。
Expand Down
3 changes: 2 additions & 1 deletion packages/amis/src/renderers/CRUD.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
items: selectedItems,
selectedItems,
unSelectedItems: unSelectedItems,
ids
ids,
event: e // 固定事件数据从event.data中获取,方便批量操作按钮绑定动作时获取动作产生的数据
});

let fn = () => {
Expand Down

0 comments on commit 5f158ad

Please sign in to comment.