给含有关键词的label着色

  • 给含有关键词的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';
      }
    }
 }

posted on 2022-12-14 17:10  anjun_xf  阅读(18)  评论(0编辑  收藏  举报

导航

TOP