mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 12:08:13 +08:00
chore: crud 的 export excel 支持配置 label 和 icon (#3782)
This commit is contained in:
parent
24f5908ec3
commit
efaab83f65
@ -2262,17 +2262,23 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
classnames: cx,
|
||||
translate: __,
|
||||
columns,
|
||||
data
|
||||
data,
|
||||
render
|
||||
} = this.props;
|
||||
|
||||
if (!columns) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Button
|
||||
classPrefix={ns}
|
||||
onClick={() => {
|
||||
return render(
|
||||
'exportExcel',
|
||||
{
|
||||
label: __('CRUD.exportExcel'),
|
||||
...(toolbar as any),
|
||||
type: 'button'
|
||||
},
|
||||
{
|
||||
onAction: () => {
|
||||
import('exceljs').then(async (ExcelJS: any) => {
|
||||
let rows = [];
|
||||
let tmpStore;
|
||||
@ -2505,11 +2511,8 @@ export default class Table extends React.Component<TableProps, object> {
|
||||
saveAs(blob, filename + '.xlsx');
|
||||
}
|
||||
});
|
||||
}}
|
||||
size="sm"
|
||||
>
|
||||
{(toolbar as Schema).label || __('CRUD.exportExcel')}
|
||||
</Button>
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user