Simple filter on vue-list detection

Posted Jun 15, 20201 min read

//searching feature
searchData:function() {
var sName = this.sName.replace(/\s+/g,"");
if(sName) {
//1. Full character detection
//return this.screenUserList.filter(function(product) {
//return Object.keys(product).some(function(key) {
//return String(product[key]).indexOf(sName)> -1
//})
//})
//2. An item in the array is detected
return this.screenUserList.filter(function(product) {
return product.yhm.indexOf(sName)> -1|| product.userrealname.indexOf(sName)> -1;
})
}
return this.screenUserList;
}