报错信息
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'wch')
报错原因
解决方法
-
定义一个空数组
header: [] -
获取中文键作为表头
// 获取obj中文键作为表头
this.header = Object.keys(obj)
- 将表头直接使用数组获取的中文键作为表头
// 设置表头
const tHeader = this.header
即可解决
ps: 如果还报错 即是代码顺序问题导致表头获取的能仍是空数组 放到处理数据之后的位置即可