前端过滤加模糊查询

 1 function gainSearch (payload) {           //payload 为查询关键字
 2   const list = window.gainList            // window.gainList 为一个对象数组 object[]
 3   let arr = []
 4   list.filter((index) => {              // 过滤每一条数据对象
 5     if (index.value1.indexOf(payload) >= 0) {    // 每条数据对象的第一个值进行模糊搜索,多个可采用 || 
 6       return arr.push(index) 7  } 8  }) 9 return arr 10 }

猜你喜欢

转载自www.cnblogs.com/s1118/p/9340737.html