Skip to content

Commit

Permalink
fix: 由于会引起问题,暂时取消列宽设置
Browse files Browse the repository at this point in the history
  • Loading branch information
FairyEver committed Nov 25, 2020
1 parent 61637cd commit f3d7f05
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 0 additions & 4 deletions src/_export2Excel.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ export function export_json_to_excel(th, jsonData, defaultTitle, options = { mer
merges = merges.map(i => i instanceof Array ? { s: i[0], e: i[1] } : i); // be sort :) # ['A1', 'C1'] => { s: 'A1', e: 'C3' }
ws['!merges'] = merges;

if(options.cols){
ws["!cols"] = options.cols;
}

/* add worksheet to workbook */
wb.SheetNames.push(ws_name);
wb.Sheets[ws_name] = ws;
Expand Down
12 changes: 2 additions & 10 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,15 @@ const vueTableExport = {
columns: [],
data: [],
title: 'table',
header: null,
merges: [],
header: null
}
// 合并参数
const _params = Object.assign({}, paramsDefault, params)
// 从参数中派生数据
const header = _params.columns.map(e => e.label)
const data = _params.data.map(row => _params.columns.map(col => row[col.prop]))

const cols = _params.columns.map(e => {
let col = {...e}
delete col.label;
delete col.prop;
return col
})
// 导出
Excel.export_json_to_excel(header, data, _params.title, { merges: _params.merges, header: _params.header,cols: cols })
Excel.export_json_to_excel(header, data, _params.title, { merges: _params.merges, header: _params.header })
// 完成
resolve()
})
Expand Down

0 comments on commit f3d7f05

Please sign in to comment.