Search function supports fuzzy query

Search function: https://blog.csdn.net/bbs11007/article/details/110948483

 

We have implemented the search function, so how to support case matching? A function we need to use for fuzzy query is: toUpperCase(),

let result = this.pages1.values.filter(row => {//this.pages1.values这个是表内所有数据
              //搜索那列的内容,这里搜索name、id等列的内容
              return row.name.indexOf(this.search1.toUpperCase()) > -1 
                || row.id.indexOf(this.search1.toUpperCase()) > -1 
                || row.code.indexOf(this.search1.toUpperCase()) > -1 
                || row.note.indexOf(this.search1.toUpperCase()) > -1;
            });

 

The wording in js is:

if (td.innerHTML.toUpperCase().indexOf(filter) > -1 || td1.innerHTML.toUpperCase().indexOf(filter) > -1 || td2.innerHTML.toUpperCase().indexOf(filter) > -1) 

There is nothing to say about this. It's just that the added position is different.

Guess you like

Origin blog.csdn.net/bbs11007/article/details/112603275