关于vue的简单过滤器-列表的检测
文章目录
//搜索功能
searchData: function() {
var sName = this.sName.replace(/\s+/g,"");
if (sName) {
//1.字符全检测
// return this.screenUserList.filter(function(product) {
// return Object.keys(product).some(function(key) {
// return String(product[key]).indexOf(sName) > -1
// })
// })
//2.数组中某一项检测
return this.screenUserList.filter(function (product) {
return product.yhm.indexOf(sName) > -1|| product.userrealname.indexOf(sName) > -1;
})
}
return this.screenUserList;
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论