mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:39:05 +08:00
Merge pull request #10209 from nwind/chore-import-default
chore: 兼容 exceljs 在部分打包配置下引入错误问题 Closes #9598
This commit is contained in:
commit
e6385a86c4
@ -160,7 +160,8 @@ export default class ExcelControl extends React.PureComponent<
|
|||||||
|
|
||||||
processExcelFile(excelData: ArrayBuffer | string, fileName: string) {
|
processExcelFile(excelData: ArrayBuffer | string, fileName: string) {
|
||||||
const {allSheets, onChange, parseImage, autoFill} = this.props;
|
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;
|
this.ExcelJS = ExcelJS;
|
||||||
const workbook = new ExcelJS.Workbook();
|
const workbook = new ExcelJS.Workbook();
|
||||||
await workbook.xlsx.load(excelData);
|
await workbook.xlsx.load(excelData);
|
||||||
|
@ -2446,7 +2446,8 @@ export default class Table extends React.Component<TableProps, object> {
|
|||||||
loading: store.exportExcelLoading,
|
loading: store.exportExcelLoading,
|
||||||
onAction: () => {
|
onAction: () => {
|
||||||
store.update({exportExcelLoading: true});
|
store.update({exportExcelLoading: true});
|
||||||
import('exceljs').then(async (ExcelJS: any) => {
|
import('exceljs').then(async (E: any) => {
|
||||||
|
const ExcelJS = E.default || E;
|
||||||
try {
|
try {
|
||||||
await exportExcel(ExcelJS, this.props, toolbar);
|
await exportExcel(ExcelJS, this.props, toolbar);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -2480,7 +2481,8 @@ export default class Table extends React.Component<TableProps, object> {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
onAction: () => {
|
onAction: () => {
|
||||||
import('exceljs').then(async (ExcelJS: any) => {
|
import('exceljs').then(async (E: any) => {
|
||||||
|
const ExcelJS = E.default || E;
|
||||||
try {
|
try {
|
||||||
await exportExcel(ExcelJS, this.props, toolbar, true);
|
await exportExcel(ExcelJS, this.props, toolbar, true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user