From 91b3dc45c47483dbf795709439631a595fa5e57f Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Sun, 25 Oct 2020 21:51:11 +0800 Subject: [PATCH] fix --- index.ts | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.ts b/index.ts index a914aba..0253a33 100644 --- a/index.ts +++ b/index.ts @@ -226,8 +226,8 @@ function importXLSX (params: InterceptorImportParams) { }) const workbook = XLSX.read(e.target.result, { type: 'binary' }) const rest = XLSX.utils.sheet_to_json(XEUtils.first(workbook.Sheets)) - const fields = XEUtils.keys(rest.slice(0, 1)[0]) - const list = rest.slice(1) + const fields = rest ? XEUtils.keys(rest[0]) : [] + const list = rest const status = checkImportData(tableFields, fields) if (status) { const records: any[] = list.map(item => { diff --git a/package.json b/package.json index 0855121..4133e07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table-plugin-export-xlsx", - "version": "2.0.4", + "version": "2.0.5", "description": "基于 vxe-table 的表格插件,支持导出 xlsx 格式", "scripts": { "lib": "gulp build"