有以下JS查询:
const conditions = this.conditionBlock.getElementsByClassName(style.Condition) || [];
下面我尝试迭代条件:
for (const condition of conditions) {
}
所以,我得到一个错误:
Type 'any[] | HTMLCollectionOf<Element>' must have a '[Symbol.iterator]()' method that returns an iterator.
如何解决?
位置:
private conditionBlock: HTMLElement;
还有
getElementsByClassName(classNames: string): HTMLCollectionOf<Element>;