SOURCE

var filterName = "K00890"
var list = [
  {
      id:1,
    sku_no : 'K00890',
    spu_name : '扁粉'
  },
  {
      id:2,
    sku_no : 'K00890',
    spu_name : '扁粉'
  },
   {
      id:3,
    sku_no : 'K00890',
    spu_name : '扁粉'
  },
   {
      id:3,
    sku_no : 's',
    spu_name : '扁粉s'
  }
]
var searchProps = [ 'sku_no','spu_name']
  const suffix = '_highlight'
    if (list) {
    list.forEach(item => {
      searchProps.forEach(key => {
        item[key + suffix] = item[key]
      })
    })
  }
//   console.log('list',list);
var filterNameTransform = String(filterName).trim().toLowerCase().replace('(', '\\(').replace(')', '\\)')
console.log(filterNameTransform);
  const filterRE = new RegExp(filterNameTransform, 'i')
  const rest = list.filter(item => searchProps.some(key => {
      var test = filterRE.test(String(item[key]));
      console.table(filterRE)
      console.log(String(item[key]) + " " + test)
    //   console.log("filterRE", "after")
      return test;
  }))
//   console.log(rest)
  const list_new =  rest.map(row => {
    const item = Object.assign({}, row)
    searchProps.forEach(key => {
      item[key + suffix] = String(item[key]).replace(filterRE, match => `<span style="color: #000;background-color: #FFFF00;">${match}</span>`)
    //   console.log(item[key + suffix])
    })
    return item
  })
//   console.log('list_new',list_new);
console 命令行工具 X clear

                    
>
console