Merge pull request #10209 from nwind/chore-import-default

chore: 兼容 exceljs 在部分打包配置下引入错误问题 Closes #9598
This commit is contained in:
hsm-lv 2024-05-13 10:42:14 +08:00 committed by GitHub
commit e6385a86c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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) {