diff --git a/index.ts b/index.ts index c31f91a..54acd09 100644 --- a/index.ts +++ b/index.ts @@ -1,8 +1,8 @@ import XEUtils from 'xe-utils' -import { VXETableCore, VxeTableConstructor, VxeTablePropTypes, VxeTableDefines, VxeGlobalInterceptorHandles } from 'vxe-table' +import type { VXETableCore, VxeTableConstructor, VxeTablePropTypes, VxeTableDefines, VxeGlobalInterceptorHandles } from 'vxe-table' import type ExcelJS from 'exceljs' -let vxetable: VXETableCore +let globalVxetable: VXETableCore let globalExcelJS: any declare module 'vxe-table' { @@ -114,7 +114,7 @@ function getDefaultBorderStyle () { function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams) { const msgKey = 'xlsx' - const { modal, t } = vxetable + const { modal, t } = globalVxetable const { $table, options, columns, colgroups, datas } = params const { props, reactData } = $table const { computeColumnOpts } = $table.getComputeMaps() @@ -323,7 +323,7 @@ function exportXLSX (params: VxeGlobalInterceptorHandles.InterceptorExportParams } function downloadFile (params: VxeGlobalInterceptorHandles.InterceptorExportParams, blob: Blob, options: VxeTablePropTypes.ExportConfig) { - const { modal, t } = vxetable + const { modal, t } = globalVxetable const { message, filename, type } = options const showMsg = message !== false if (window.Blob) { @@ -350,7 +350,7 @@ function checkImportData (tableFields: string[], fields: string[]) { } function importError (params: VxeGlobalInterceptorHandles.InterceptorImportParams) { - const { modal, t } = vxetable + const { modal, t } = globalVxetable const { $table, options } = params const { internalData } = $table const { _importReject } = internalData @@ -364,7 +364,7 @@ function importError (params: VxeGlobalInterceptorHandles.InterceptorImportParam } function importXLSX (params: VxeGlobalInterceptorHandles.InterceptorImportParams) { - const { modal, t } = vxetable + const { modal, t } = globalVxetable const { $table, columns, options, file } = params const { internalData } = $table const { _importResolve } = internalData @@ -460,6 +460,7 @@ export const VXETablePluginExportXLSX = { console.error('[vxe-table-plugin-export-pdf] Version vxe-table 4.x is required') } + globalVxetable = vxetable globalExcelJS = options ? options.ExcelJS : null vxetable.config({ diff --git a/package.json b/package.json index ff463e9..8200f56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table-plugin-export-xlsx", - "version": "4.0.0", + "version": "4.0.1", "description": "基于 vxe-table 表格的扩展插件,支持导出 xlsx 格式", "scripts": { "lib": "gulp build"