我目前仅按名称搜索。此外,还要考虑大小写字母。如何搜索用户的所有参数?而不考虑大小写字母?
我有以下选项:lastName
,company
,title
,email
,phone
,street
,city
,country
。
dispatch => ({
onFindPeople: (firstName) => {
console.log(firstName);
dispatch({ type: 'FIND_PEOPLE', payload: firstName})
}
})
我添加了示例代码here
答案 0 :(得分:1)
尝试
const isMatch = (user, filter) =>
new RegExp(filter, "i").test(JSON.stringify(user));
state.allPeople.filter(user => isMatch(user, state.filterPeople));