mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-26 04:09:21 +08:00
feat(table): action增加before配置
This commit is contained in:
parent
15b202a9be
commit
912639999d
@ -116,6 +116,7 @@ const copyHandler = async (action: ColumnActionConfig, row: any) => {
|
||||
};
|
||||
|
||||
const actionHandler = async (action: ColumnActionConfig, row: any, index: number) => {
|
||||
await action.before?.(row);
|
||||
if (action.type === 'delete') {
|
||||
await deleteAction(action, row);
|
||||
} else if (action.type === 'copy') {
|
||||
@ -124,8 +125,8 @@ const actionHandler = async (action: ColumnActionConfig, row: any, index: number
|
||||
props.editState[index] = row;
|
||||
} else {
|
||||
await action.handler?.(row);
|
||||
action.after?.();
|
||||
}
|
||||
action.after?.(row);
|
||||
};
|
||||
|
||||
const save = async (index: number, config: ColumnConfig) => {
|
||||
|
@ -24,7 +24,8 @@ export interface ColumnActionConfig {
|
||||
text: string;
|
||||
name: string;
|
||||
handler?: (row: any) => Promise<any> | any;
|
||||
after?: () => void;
|
||||
before?: (row: any) => void;
|
||||
after?: (row: any) => void;
|
||||
action?: (data: { data: any }) => void;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user