From c978a5bf64c6e8d0cad0694aea7db872fefb5a8a Mon Sep 17 00:00:00 2001 From: DevOps Date: Tue, 23 Dec 2025 23:48:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20iOS=20Safari=20?= =?UTF-8?q?=E5=BF=AB=E9=80=9F=E7=82=B9=E5=87=BB=E6=8C=89=E9=92=AE=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E9=A1=B5=E9=9D=A2=E7=BC=A9=E6=94=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 touch-action: manipulation 禁用双击缩放 - 添加 -webkit-tap-highlight-color: transparent 移除点击高亮 - 在全局样式和修改评分页面按钮上应用 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- App.vue | 31 +++++++++++++++++++-- common/common.css | 11 ++++++++ index.html | 28 +++++++++++++++++-- pages/modify-score/modify-score.vue | 8 ++++-- pages/score-list-multi/score-list-multi.vue | 6 ++++ 5 files changed, 78 insertions(+), 6 deletions(-) diff --git a/App.vue b/App.vue index 9508cda..1ca534c 100644 --- a/App.vue +++ b/App.vue @@ -2,17 +2,44 @@ export default { onLaunch: function() { console.log('App Launch') + // 禁用 iOS Safari 双击缩放 + this.disableDoubleTapZoom() }, onShow: function() { console.log('App Show') }, onHide: function() { console.log('App Hide') + }, + methods: { + disableDoubleTapZoom() { + // #ifdef H5 + let lastTouchEnd = 0 + document.documentElement.addEventListener('touchstart', function(event) { + if (event.touches.length > 1) { + event.preventDefault() + } + }, { passive: false }) + + document.documentElement.addEventListener('touchend', function(event) { + const now = Date.now() + if (now - lastTouchEnd <= 300) { + event.preventDefault() + } + lastTouchEnd = now + }, { passive: false }) + + // 禁用手势缩放 + document.documentElement.addEventListener('gesturestart', function(event) { + event.preventDefault() + }, { passive: false }) + // #endif + } } } diff --git a/common/common.css b/common/common.css index 20ff13e..8bde1fc 100644 --- a/common/common.css +++ b/common/common.css @@ -28,3 +28,14 @@ button::after { input { outline: none; } + +/* 防止 iOS Safari 双击缩放 */ +button, .control-btn, [class*="btn"] { + touch-action: manipulation; + -webkit-tap-highlight-color: transparent; +} + +/* 全局禁用双击缩放 */ +html { + touch-action: manipulation; +} diff --git a/index.html b/index.html index 9d0aeff..57f643c 100644 --- a/index.html +++ b/index.html @@ -3,15 +3,39 @@ - + 武术评分系统 + +
- diff --git a/pages/modify-score/modify-score.vue b/pages/modify-score/modify-score.vue index 657e462..b12e37f 100644 --- a/pages/modify-score/modify-score.vue +++ b/pages/modify-score/modify-score.vue @@ -50,7 +50,7 @@ - + -0.001 @@ -60,7 +60,7 @@ 可不改 - + +0.001 @@ -459,6 +459,10 @@ export default { } .control-btn { + touch-action: manipulation; + -webkit-tap-highlight-color: transparent; + user-select: none; + -webkit-user-select: none; width: 140rpx; height: 140rpx; display: flex; diff --git a/pages/score-list-multi/score-list-multi.vue b/pages/score-list-multi/score-list-multi.vue index 666bee9..9e6bc19 100644 --- a/pages/score-list-multi/score-list-multi.vue +++ b/pages/score-list-multi/score-list-multi.vue @@ -389,6 +389,8 @@ export default { position: relative; white-space: nowrap; flex-shrink: 0; + touch-action: manipulation; + -webkit-tap-highlight-color: transparent; } .venue-tab.active { @@ -441,6 +443,8 @@ export default { color: #666666; white-space: nowrap; flex-shrink: 0; + touch-action: manipulation; + -webkit-tap-highlight-color: transparent; } .project-btn.active { @@ -527,6 +531,8 @@ export default { font-size: 28rpx; color: #FFFFFF; font-weight: 500; + touch-action: manipulation; + -webkit-tap-highlight-color: transparent; } .modify-btn:active {