diff --git a/h5/pages/components/goHome.vue b/h5/pages/components/goHome.vue index 74089b5..5685b30 100644 --- a/h5/pages/components/goHome.vue +++ b/h5/pages/components/goHome.vue @@ -17,16 +17,17 @@ const button = ref(null); let startX, startY, posX, posY, mouseMoveTracker, mouseUpTracker; const goHome = () => { - console.log(11); uni.reLaunch({ url: "/pages/main/index/index" }); }; const dragButton = (event) => { // event.preventDefault(); - - // 初始化坐标 - startX = event.touches[0]?.clientX - button.value.offsetLeft; - startY = event.touches[0]?.clientY - button.value.offsetTop; + console.log(event.touches, "48566546546545"); + if (event.touches) { + // 初始化坐标 + startX = event.touches[0]?.clientX - button.value.offsetLeft; + startY = event.touches[0]?.clientY - button.value.offsetTop; + } // 添加鼠标移动监听 mouseMoveTracker = (event) => {