fix: Table无法处理动作未交给上层处理 (#4710)

This commit is contained in:
RUNZE LU 2022-06-27 15:21:59 +08:00 committed by GitHub
parent 2b9964957b
commit a6fe86744a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 46 additions and 4 deletions

View File

@ -541,16 +541,53 @@ Cards 模式支持 [Cards](./cards) 中的所有功能。
```schema: scope="body"
{
"type": "crud",
"name": "crud",
"syncLocation": false,
"api": "/api/mock2/sample",
"filter": {
"title": "条件搜索",
"body": [
{
"type": "input-text",
"name": "keywords",
"placeholder": "通过关键字搜索"
"type": "flex",
"justify": "space-between",
"alignItems": "center",
"items": [
{
"type": "input-text",
"name": "keywords",
"placeholder": "通过关键字搜索",
"size": "sm"
},
{
"type": "button",
"actionType": "drawer",
"icon": "fa fa-plus",
"label": "创建记录",
"target": "crud",
"closeOnOutside": true,
"drawer": {
"title": "创建记录",
"body": {
"type": "form",
"api": "post:/api/mock2/sample",
"body": [
{
"type": "input-text",
"name": "engine",
"label": "Engine"
},
{
"type": "input-text",
"name": "browser",
"label": "Browser"
}
]
}
}
}
]
}
]
},
"columns": [

View File

@ -803,7 +803,11 @@ export default class Table extends React.Component<TableProps, object> {
form && this.props.store.addForm(form.props.store, y);
}
handleAction(e: React.UIEvent<any>, action: ActionObject, ctx: object) {
handleAction(
e: React.UIEvent<any> | undefined,
action: ActionObject,
ctx: object
) {
const {onAction} = this.props;
// todo
@ -2720,6 +2724,7 @@ export default class Table extends React.Component<TableProps, object> {
store.toggleDragging();
break;
default:
this.handleAction(undefined, action, data);
break;
}
}