1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-08-07 18:25:45 +08:00

Merge 9fadf3272d8cad40225e2e819b81469c44988a92 into 0caa975ee224074c77540107b1fe076081cdf306

This commit is contained in:
codersjj 2022-04-19 18:52:30 +08:00 committed by GitHub
commit 514f921aad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -182,14 +182,16 @@ export function export_json_to_excel({
'wch': 10
};
}
/*再判断是否为中文*/
else if (val.toString().charCodeAt(0) > 255) {
/*再判断是否存在中文*/
val = val.toString()
const chineseCharacters = val.match(/[\u4E00-\u9FA5]/g)
if (chineseCharacters) {
return {
'wch': val.toString().length * 2
'wch': chineseCharacters.length * 2 + (val.length - chineseCharacters.length)
};
} else {
return {
'wch': val.toString().length
'wch': val.length
};
}
}))