提交 52dccd32 authored 作者: 龙菲's avatar 龙菲

删除touch事件

上级 72882efa
差异被折叠。
......@@ -17,7 +17,6 @@ declare module 'vue' {
ElRow: typeof import('element-plus/es')['ElRow']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
FileUpload: typeof import('./components/FileUpload.vue')['default']
FlipBook: typeof import('./components/FlipBook/index.vue')['default']
GuideMobile: typeof import('./components/GuideMobile/index.vue')['default']
GuidePc: typeof import('./components/GuidePc/index.vue')['default']
IconCommunity: typeof import('./components/icons/IconCommunity.vue')['default']
......
<template>
<div
class="book-reader"
@touchstart="handleTouchStart"
@touchend="handleTouchEnd"
v-loading="loading && initialLoading"
element-loading-text="正在加载图书..."
>
......@@ -218,31 +216,6 @@ const checkMobile = () => {
);
};
// 处理触摸事件
const handleTouchStart = (e) => {
if (!isMobile.value) return;
touchStartX.value = e.touches[0].clientX;
touchStartY.value = e.touches[0].clientY;
};
const handleTouchEnd = throttle((e) => {
if (!isMobile.value) return;
const touchEndX = e.changedTouches[0].clientX;
const touchEndY = e.changedTouches[0].clientY;
const deltaX = touchEndX - touchStartX.value;
const deltaY = touchEndY - touchStartY.value;
// 这里与卷边的移动冲突,需要处理得更优雅
// 如果水平滑动距离大于垂直滑动距离,且大于50px,则触发翻页
// if (Math.abs(deltaX) > Math.abs(deltaY) && Math.abs(deltaX) > 50) {
// if (deltaX > 0) {
// previousPage();
// } else {
// nextPage();
// }
// }
});
// 修改处理页面的函数,只处理必要的属性
const processPages = (pages) => {
return pages.map((item, index) => ({
......@@ -424,7 +397,7 @@ const initBook = async () => {
acceleration: true,
gradients: true,
elevation: 80,
duration: 800,
duration: 200,
autoCenter: true,
turnCorners: "bl,br",
page: 1,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论