c1——
遍历json的key...value的时候报错:
[tslint] for (... in ...) statements must be filtered with an if statement
原代码:
for (let key in this.targetList[0]) { this.tableHeaders.push({ value: key, name: key }) }
修改为:
for (const key of Object.keys(this.targetList[0])) { this.tableHeaders.push({ value: key, name: key }) }
OK!
原理解析:
原文地址:https://www.cnblogs.com/Zhang-jin/p/10411395.html
时间: 2024-10-02 22:15:40