chore: 兼容 exceljs 在部分打包配置下引入错误问题 Closes #9598

This commit is contained in:
wuduoyi 2024-05-10 17:53:05 +08:00
parent c9fa51ea07
commit 2ab65724a2
2 changed files with 6 additions and 3 deletions

View File

@ -160,7 +160,8 @@ export default class ExcelControl extends React.PureComponent<
processExcelFile(excelData: ArrayBuffer | string, fileName: string) {
const {allSheets, onChange, parseImage, autoFill} = this.props;
import('exceljs').then(async (ExcelJS: any) => {
import('exceljs').then(async (E: any) => {
const ExcelJS = E.default || E;
this.ExcelJS = ExcelJS;
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.load(excelData);

View File

@ -2446,7 +2446,8 @@ export default class Table extends React.Component<TableProps, object> {
loading: store.exportExcelLoading,
onAction: () => {
store.update({exportExcelLoading: true});
import('exceljs').then(async (ExcelJS: any) => {
import('exceljs').then(async (E: any) => {
const ExcelJS = E.default || E;
try {
await exportExcel(ExcelJS, this.props, toolbar);
} catch (error) {
@ -2480,7 +2481,8 @@ export default class Table extends React.Component<TableProps, object> {
},
{
onAction: () => {
import('exceljs').then(async (ExcelJS: any) => {
import('exceljs').then(async (E: any) => {
const ExcelJS = E.default || E;
try {
await exportExcel(ExcelJS, this.props, toolbar, true);
} catch (error) {