list.filter(isSearched(pattern))......
这么一段代码,filter后list始终是空的,后来才发现
const isSearched = searchTerm => item => //console.log("title:" + item.title + "----searchTerm:" + searchTerm); // if (item.title.toLowerCase().includes(searchTerm.toLowerCase())) { // console.log("includes"); // } else { // console.log("not"); // } //item.title.toLowerCase().includes(searchTerm.toLowerCase()); item.title.toLowerCase().includes(searchTerm.toLowerCase());
这个函数不能加{ },否则一定出错。