Skip to content

Commit

Permalink
优化导出
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jul 12, 2023
1 parent f652615 commit 2baa9b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit 2baa9b8

Please sign in to comment.