You've already forked SmartisanNote.Remake
\"优化 便签列表页面交互体验,添加便签滑动状态管理,防止在滑动状态下误触编辑页面\"
This commit is contained in:
3
IFLOW.md
3
IFLOW.md
@@ -165,5 +165,4 @@ npm run android
|
||||
* 对于错误修复,使用 `修复` 前缀。
|
||||
* 对于性能优化、代码重构(既不修复错误也不添加功能),使用 `优化` 前缀。
|
||||
* 对于文档更新,使用 `文档` 前缀。
|
||||
* 提交信息应使用中文。
|
||||
* 每次提交代码时,如果涉及功能变更,应在 `update.txt` 文件中添加相应的更新日志,格式为日期和变更描述。
|
||||
* 提交信息应使用中文。
|
||||
@@ -31,6 +31,8 @@
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
|
||||
const props = defineProps({
|
||||
content: {
|
||||
type: String,
|
||||
@@ -139,6 +141,9 @@ const handlePress = () => {
|
||||
// 只有在未滑动状态下才触发点击事件
|
||||
if (slideOffset.value === 0 && props.onPress) {
|
||||
props.onPress()
|
||||
} else if (slideOffset.value !== 0) {
|
||||
// 如果当前处于滑动状态,重置滑动状态(收回便签条)
|
||||
resetSlideState()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,6 +174,21 @@ const handleDelete = () => {
|
||||
isSlided.value = false
|
||||
}
|
||||
|
||||
// 重置滑动状态
|
||||
const resetSlideState = () => {
|
||||
slideOffset.value = 0
|
||||
isSliding.value = false
|
||||
isSlided.value = false
|
||||
}
|
||||
|
||||
// 获取滑动状态
|
||||
const getSlideState = () => {
|
||||
return isSlided.value
|
||||
}
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({ resetSlideState, getSlideState })
|
||||
|
||||
// 触摸开始事件处理函数
|
||||
// 记录触摸开始时的X坐标,用于计算滑动距离
|
||||
const handleTouchStart = e => {
|
||||
@@ -216,7 +236,7 @@ const handleTouchMove = e => {
|
||||
e.stopPropagation()
|
||||
// 阻止父级滚动容器的滚动行为
|
||||
e.stopImmediatePropagation()
|
||||
|
||||
|
||||
// 只有当滑动达到一定距离时才阻止页面滚动
|
||||
if (diffX > 5) {
|
||||
e.preventDefault() // 防止页面滚动
|
||||
|
||||
@@ -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}`)
|
||||
}
|
||||
|
||||
22
update.txt
22
update.txt
@@ -1,22 +0,0 @@
|
||||
2025.10.16
|
||||
优化 移动端图片拖拽体验和视觉反馈;
|
||||
新增 图片排序后自动退出排序模式;
|
||||
新增 为图片添加移除按钮;
|
||||
|
||||
2025.10.14
|
||||
优化 便签列表页上下滑动时不再触发标签条的移动;
|
||||
优化 调整了编辑器中的工具栏显示隐藏逻辑;
|
||||
新增 编辑器现在可以拖拽图片排序了;
|
||||
|
||||
2025.10.13
|
||||
优化 便签列表页布局调整;
|
||||
新增 便签删除功能;
|
||||
优化 便签列表页布局;
|
||||
新增 设置块组件;
|
||||
新增 开关按钮组件;
|
||||
优化 头部便签管理点击区域;
|
||||
调整了若干样式;
|
||||
|
||||
2025.10.12
|
||||
优化 时间显示格式调整;
|
||||
优化 编辑器中的图片显示尺寸;
|
||||
Reference in New Issue
Block a user