From f6526153da7c0bbb54dda023ae540317ed1209eb Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Sat, 8 Jul 2023 14:10:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++++ index.ts | 7 ++++--- package.json | 8 ++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a671989..365ec3e 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,10 @@ 基于 [vxe-table](https://www.npmjs.com/package/vxe-table) 的表格插件,支持导出 pdf 格式,基于 [jspdf](https://github.com/MrRio/jsPDF) 实现 +## Compatibility + +对应 vxe-table v4 版本 + ## Installing ```shell diff --git a/index.ts b/index.ts index decb736..97b5f3a 100644 --- a/index.ts +++ b/index.ts @@ -59,11 +59,12 @@ function exportPDF (params: VxeGlobalInterceptorHandles.InterceptorExportParams) const { type, filename, isHeader, isFooter, original } = options const footList: { [key: string]: any }[] = [] const headers: any[] = columns.map((column) => { - const title = XEUtils.toValueString(original ? column.field : column.getTitle()) - const width = column.renderWidth / ratio + const { id, field, renderWidth, headerExportMethod } = column as any + const title = headerExportMethod ? headerExportMethod({ column, $table }) : (XEUtils.toValueString(original ? field : column.getTitle())) + const width = renderWidth / ratio colWidth += width return { - name: column.id, + name: id, prompt: getCellText(title), width } diff --git a/package.json b/package.json index 503a41b..2632f48 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table-plugin-export-pdf", - "version": "3.0.4", + "version": "3.0.5", "description": "基于 vxe-table 的表格插件,支持导出 pdf 格式", "scripts": { "lib": "gulp build" @@ -51,9 +51,9 @@ "prettier": "^2.1.2", "sass": "^1.55.0", "typescript": "^4.6.4", - "vue": "^3.2.39", - "vxe-table": "^4.3.5", - "xe-utils": "^3.5.6" + "vue": "^3.3.4", + "vxe-table": "^4.4.6", + "xe-utils": "^3.5.11" }, "peerDependencies": { "vxe-table": "^4.0.27"