我遇到了一个奇怪的问题,不确定是什么问题。我正在为 API 获取对象,对象在浏览器的控制台中看起来像这样
const obj: any;
this.obj = {"pots":[{"id":"23293839","name":"Label · L5","active":true,"parentid":"23293827","level":4}]}
for (const temp of this.obj['pots']) {}
现在当我试图遍历
pots
数组时,它给我错误提示
this.obj.pots is not iterable
我尝试了各种方法,但找不到解决方案。