From 2baa9b8f5cba5d07224ddcac02015c1337890515 Mon Sep 17 00:00:00 2001 From: xuliangzhan Date: Wed, 12 Jul 2023 08:15:26 +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 --- index.ts | 8 +++++--- package.json | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/index.ts b/index.ts index 97b5f3a..8363be1 100644 --- a/index.ts +++ b/index.ts @@ -47,8 +47,9 @@ function exportPDF (params: VxeGlobalInterceptorHandles.InterceptorExportParams) const { $table, options, columns, datas } = params const { props } = $table const { treeConfig } = props - const { computeTreeOpts } = $table.getComputeMaps() + const { computeColumnOpts, computeTreeOpts } = $table.getComputeMaps() const treeOpts = computeTreeOpts.value + const columnOpts = computeColumnOpts.value const dX = 7 const dY = 15.8 const ratio = 3.78 @@ -59,8 +60,9 @@ function exportPDF (params: VxeGlobalInterceptorHandles.InterceptorExportParams) const { type, filename, isHeader, isFooter, original } = options const footList: { [key: string]: any }[] = [] const headers: any[] = columns.map((column) => { - const { id, field, renderWidth, headerExportMethod } = column as any - const title = headerExportMethod ? headerExportMethod({ column, $table }) : (XEUtils.toValueString(original ? field : column.getTitle())) + const { id, field, renderWidth } = column + const headExportMethod = (column as any).headerExportMethod || (columnOpts as any).headerExportMethod + const title = headExportMethod ? headExportMethod({ column, options, $table }) : (XEUtils.toValueString(original ? field : column.getTitle())) const width = renderWidth / ratio colWidth += width return { diff --git a/package.json b/package.json index 2632f48..7e4ada4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vxe-table-plugin-export-pdf", - "version": "3.0.5", + "version": "3.0.6", "description": "基于 vxe-table 的表格插件,支持导出 pdf 格式", "scripts": { "lib": "gulp build"