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 {