未验证 提交 d16f6f8e 编写于 作者: D destiny 提交者: GitHub

fix(component): 解决导出excel数据某一项为null时计算宽度报错 (#2338)

上级 fc2e2c87
......@@ -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) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册