shaogen1995 1 år sedan
förälder
incheckning
ee3d28bbf3
1 ändrade filer med 10 tillägg och 7 borttagningar
  1. 10 7
      src/views/PaintingDetail.vue

+ 10 - 7
src/views/PaintingDetail.vue

@@ -244,22 +244,25 @@ const props = defineProps({
 const lastY = ref(0)
 // 开始滑动
 const handletouchstartUp = (event) => {
-  emit("touch-up")
   lastY.value = event.changedTouches[0].pageY
 }
 
 onMounted(() => {
-  // console.log('pppppppp', props.direction, props.title)
 })
 
 const touchEndUp = (event) => {
   let currentY = event.changedTouches[0].pageY
-  let ty = currentY - lastY.value
-  if (ty > 0) {
-    console.log("向下")
+
+  // console.log("-----", currentY, lastY.value)
+
+  if (currentY - lastY.value > 30) {
+    // 向下
+    console.log("向下11")
     onSwipeDown()
-  } else if (ty < 0) {
-    console.log("向上")
+  }
+  if (lastY.value - currentY > 30) {
+    emit("touch-up")
+    console.log("向上11")
     onSwipeTop()
   }
 }