From 39d9c1a76a154c71482b25b5019a7579585c7087 Mon Sep 17 00:00:00 2001 From: linxi <957440651@qq.com> Date: Thu, 5 Feb 2026 17:41:09 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E6=97=85=E5=B1=85=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E6=97=A5=E6=9C=9F=E8=BF=99=E9=87=8C=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=8A=A0=E4=B8=AA=E5=B7=A6=E5=8F=B3=E6=BB=91=E5=8A=A8=E7=BF=BB?= =?UTF-8?q?=E9=A1=B5=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DateRangePicker/DateRangePicker.vue | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/components/DateRangePicker/DateRangePicker.vue b/components/DateRangePicker/DateRangePicker.vue index f1ea6b9..95a24cf 100644 --- a/components/DateRangePicker/DateRangePicker.vue +++ b/components/DateRangePicker/DateRangePicker.vue @@ -14,7 +14,7 @@ 原定时间:{{ originDate }} - + @@ -111,7 +111,9 @@ export default { tempStartDate: null, tempEndDate: null, dateStatusMap: {}, // 存储日期状态 - selectionState: 'initial' // 'initial' | 'selecting' | 'completed' + selectionState: 'initial', // 'initial' | 'selecting' | 'completed' + touchStartX: 0, + touchStartY: 0 } }, @@ -253,6 +255,28 @@ export default { this.currentMonth = newMonth }, + onTouchStart(e) { + if (!e || !e.changedTouches || !e.changedTouches.length) return + this.touchStartX = e.changedTouches[0].clientX + this.touchStartY = e.changedTouches[0].clientY + }, + + onTouchEnd(e) { + if (!e || !e.changedTouches || !e.changedTouches.length) return + const touchEndX = e.changedTouches[0].clientX + const touchEndY = e.changedTouches[0].clientY + const deltaX = touchEndX - this.touchStartX + const deltaY = touchEndY - this.touchStartY + if (Math.abs(deltaX) <= Math.abs(deltaY)) return + const minDistance = 50 + if (Math.abs(deltaX) < minDistance) return + if (deltaX < 0) { + this.changeMonth(1) + } else { + this.changeMonth(-1) + } + }, + formatDate(date) { if (!date) return '' const year = date.getFullYear() @@ -697,4 +721,4 @@ export default { transform: scale(1); } } - \ No newline at end of file +