You've already forked SmartisanNote.Remake
新增 编辑器现在可以拖拽图片排序了
This commit is contained in:
@@ -115,16 +115,22 @@ const SLIDE_THRESHOLD = 64 // 4rem 转换为 px
|
||||
const handleContainerTouchStart = e => {
|
||||
// 阻止事件冒泡到父组件
|
||||
e.stopPropagation()
|
||||
// 阻止父级滚动容器的滚动行为
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
|
||||
const handleContainerTouchMove = e => {
|
||||
// 阻止事件冒泡到父组件
|
||||
e.stopPropagation()
|
||||
// 阻止父级滚动容器的滚动行为
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
|
||||
const handleContainerTouchEnd = e => {
|
||||
// 阻止事件冒泡到父组件
|
||||
e.stopPropagation()
|
||||
// 阻止父级滚动容器的滚动行为
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
|
||||
// 处理便签点击事件
|
||||
@@ -168,6 +174,8 @@ const handleDelete = () => {
|
||||
const handleTouchStart = e => {
|
||||
// 阻止事件冒泡到父组件,防止页面滚动时触发便签滑动
|
||||
e.stopPropagation()
|
||||
// 阻止父级滚动容器的滚动行为
|
||||
e.stopImmediatePropagation()
|
||||
// 重置滑动状态
|
||||
startX.value = e.touches[0].clientX
|
||||
startY.value = e.touches[0].clientY // 记录起始Y坐标
|
||||
@@ -187,12 +195,18 @@ const handleTouchMove = e => {
|
||||
const diffY = currentY - startY.value
|
||||
|
||||
// 如果已经确定是滚动,则不再处理
|
||||
if (isScrolling.value) return
|
||||
if (isScrolling.value) {
|
||||
// 阻止事件冒泡到父组件,防止页面滚动时触发便签滑动
|
||||
e.stopPropagation()
|
||||
return
|
||||
}
|
||||
|
||||
// 判断是滚动还是滑动操作
|
||||
// 如果Y轴移动距离大于X轴移动距离,则认为是滚动
|
||||
if (Math.abs(diffY) > Math.abs(diffX)) {
|
||||
isScrolling.value = true
|
||||
// 阻止事件冒泡到父组件,防止页面滚动时触发便签滑动
|
||||
e.stopPropagation()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -242,6 +256,8 @@ const handleTouchEnd = e => {
|
||||
|
||||
// 阻止事件冒泡到父组件,防止页面滚动时触发便签滑动
|
||||
e?.stopPropagation()
|
||||
// 阻止父级滚动容器的滚动行为
|
||||
e?.stopImmediatePropagation()
|
||||
|
||||
// 如果滑动超过阈值,保持滑出状态;否则回弹
|
||||
if (slideOffset.value >= SLIDE_THRESHOLD) {
|
||||
|
||||
Reference in New Issue
Block a user