FelixTDT 4 月之前
父节点
当前提交
972dbd55e5
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/app/home/home.page.ts

+ 3 - 3
src/app/home/home.page.ts

@@ -40,9 +40,9 @@ export class HomePage implements OnInit {
 
   onSearch(event: any) {
     const query = event.target.value.toLowerCase();
-    this.filteredItems = this.items.filter(item =>
-      item.title.toLowerCase().includes(query) ||
-      item.description.toLowerCase().includes(query)
+    this.filteredItems = this.items.filter(item => 
+      (item.title && item.title.toLowerCase().includes(query)) || 
+      (item.description && item.description.toLowerCase().includes(query))
     );
   }