fix:fix `undefined` bug in export excel
This commit is contained in:
parent
91bd31e1e2
commit
4940dd4040
|
@ -128,8 +128,12 @@ export function export_json_to_excel(th, jsonData, defaultTitle) {
|
||||||
|
|
||||||
/*设置worksheet每列的最大宽度*/
|
/*设置worksheet每列的最大宽度*/
|
||||||
const colWidth = data.map(row => row.map(val => {
|
const colWidth = data.map(row => row.map(val => {
|
||||||
/*判断是否为中文*/
|
/*先判断是否为null/undefined*/
|
||||||
if (val.toString().charCodeAt(0) > 255) {
|
if (val == null) {
|
||||||
|
return {'wch': 10};
|
||||||
|
}
|
||||||
|
/*再判断是否为中文*/
|
||||||
|
else if (val.toString().charCodeAt(0) > 255) {
|
||||||
return {'wch': val.toString().length * 2};
|
return {'wch': val.toString().length * 2};
|
||||||
} else {
|
} else {
|
||||||
return {'wch': val.toString().length};
|
return {'wch': val.toString().length};
|
||||||
|
|
Loading…
Reference in New Issue