fix: 空数据时给空表格
This commit is contained in:
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user