You've already forked SmartisanNote.Remake
fix: 搜索功能空值检查修复
This commit is contained in:
465
console.txt
465
console.txt
File diff suppressed because one or more lines are too long
@@ -97,11 +97,13 @@ const trashNotesCount = computed(() => {
|
|||||||
// 根据当前文件夹过滤便签
|
// 根据当前文件夹过滤便签
|
||||||
const filteredNotes = computed(() => {
|
const filteredNotes = computed(() => {
|
||||||
// 预处理搜索查询,提高性能
|
// 预处理搜索查询,提高性能
|
||||||
const lowerCaseQuery = searchQuery.value.toLowerCase().trim()
|
const lowerCaseQuery = searchQuery.value?.toLowerCase().trim() || ''
|
||||||
|
|
||||||
return store.notes.filter(note => {
|
return store.notes.filter(note => {
|
||||||
// 先检查搜索条件
|
// 先检查搜索条件
|
||||||
const matchesSearch = !lowerCaseQuery || note.title.toLowerCase().includes(lowerCaseQuery) || note.content.toLowerCase().includes(lowerCaseQuery)
|
const matchesSearch = !lowerCaseQuery ||
|
||||||
|
(note.title && note.title.toLowerCase().includes(lowerCaseQuery)) ||
|
||||||
|
(note.content && note.content.toLowerCase().includes(lowerCaseQuery))
|
||||||
|
|
||||||
if (!matchesSearch) return false
|
if (!matchesSearch) return false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user