- 给含有关键词的label着色
FineFileType() {
let arr = document.querySelectorAll('.el-checkbox__label');
for (let index = 0; index < arr.length; index++) {
const element = arr[index] as HTMLLabelElement;
let txt = element.innerText;
if (this.kyWord && txt.indexOf(this.kyWord) >= 0) {
element.style.color = 'red';
} else {
element.style.color = 'black';
}
}
}
标签:index,arr,关键词,element,着色,let,label
From: https://www.cnblogs.com/anjun-xy/p/16982704.html