fix(component): 解决导出excel数据某一项为null时计算宽度报错 (#2338)
This commit is contained in:
parent
fc2e2c8789
commit
d16f6f8e44
|
|
@ -17,8 +17,8 @@ function setColumnWidth(data, worksheet, min = 3) {
|
|||
data.forEach((item) => {
|
||||
Object.keys(item).forEach((key) => {
|
||||
const cur = item[key];
|
||||
const length = cur.length;
|
||||
obj[key] = Math.max(min, length);
|
||||
const length = cur?.length ?? min;
|
||||
obj[key] = Math.max(length, obj[key] ?? min);
|
||||
});
|
||||
});
|
||||
Object.keys(obj).forEach((key) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue