Skip to content

Commit

Permalink
优化导出
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jul 8, 2023
1 parent 8940caa commit f652615
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions 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.4",
"version": "3.0.5",
"description": "基于 vxe-table 的表格插件,支持导出 pdf 格式",
"scripts": {
"lib": "gulp build"
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f652615

Please sign in to comment.