You've already forked SmartisanNote.Remake
\"优化 便签列表页面交互体验,添加便签滑动状态管理,防止在滑动状态下误触编辑页面\"
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
:isFolderExpanded="isFolderExpanded"
|
||||
:onTitlePress="handleFolderToggle"
|
||||
slot="fixed" />
|
||||
|
||||
|
||||
<!-- 悬浮文件夹列表 - 使用绝对定位实现 -->
|
||||
<div v-if="isFolderExpanded" class="folder-list" slot="fixed">
|
||||
<FolderManage
|
||||
@@ -35,7 +35,11 @@
|
||||
<transition-group name="note-list" tag="div" class="notes-list">
|
||||
<div v-for="note in filteredAndSortedNotes" :key="note.id" class="note-item">
|
||||
<NoteItem
|
||||
:title="note.title"
|
||||
:ref="
|
||||
el => {
|
||||
if (el) noteItemRefs[note.id] = el
|
||||
}
|
||||
"
|
||||
:content="note.content"
|
||||
:date="formatDate(note.updatedAt)"
|
||||
:isStarred="note.isStarred"
|
||||
@@ -66,6 +70,7 @@ import { IonContent, IonPage } from '@ionic/vue'
|
||||
|
||||
const store = useAppStore()
|
||||
const router = useRouter()
|
||||
const noteItemRefs = ref({})
|
||||
|
||||
// 页面挂载时加载初始数据
|
||||
onMounted(() => {
|
||||
@@ -103,9 +108,8 @@ const filteredNotes = computed(() => {
|
||||
|
||||
return store.notes.filter(note => {
|
||||
// 先检查搜索条件
|
||||
const matchesSearch = !lowerCaseQuery ||
|
||||
(note.title && typeof note.title === 'string' && note.title.toLowerCase().includes(lowerCaseQuery)) ||
|
||||
(note.content && typeof note.content === 'string' && note.content.toLowerCase().includes(lowerCaseQuery))
|
||||
const matchesSearch =
|
||||
!lowerCaseQuery || (note.title && typeof note.title === 'string' && note.title.toLowerCase().includes(lowerCaseQuery)) || (note.content && typeof note.content === 'string' && note.content.toLowerCase().includes(lowerCaseQuery))
|
||||
|
||||
if (!matchesSearch) return false
|
||||
|
||||
@@ -172,6 +176,21 @@ const allNotesCount = computed(() => {
|
||||
})
|
||||
|
||||
const handleNotePress = noteId => {
|
||||
// 检查是否有便签条处于展开状态
|
||||
let hasSlidedNote = false
|
||||
Object.values(noteItemRefs.value).forEach(noteItem => {
|
||||
// 注意:isSlided是ref值,需要通过.value访问
|
||||
if (noteItem && noteItem.getSlideState()) {
|
||||
hasSlidedNote = true
|
||||
noteItem.resetSlideState()
|
||||
}
|
||||
})
|
||||
|
||||
// 如果有便签条处于展开状态,不跳转到编辑页面
|
||||
if (hasSlidedNote) {
|
||||
return
|
||||
}
|
||||
|
||||
// 使用vue-router导航到编辑页面
|
||||
router.push(`/editor/${noteId}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user