fix: 空数据时给空表格

This commit is contained in:
TsMask
2023-10-09 19:59:05 +08:00
parent 62410620ed
commit f7a1a78679

View File

@@ -54,6 +54,9 @@ export async function readSheet(
*
*/
export async function writeSheet(data: any[], sheetName: string) {
if (data.length === 0) {
return new Blob([], { type: 'application/octet-stream' });
}
const workSheet = utils.json_to_sheet(data);
// 设置列宽度,单位厘米
workSheet['!cols'] = Object.keys(data[0]).map(() => {