From 1b567a9d3c8b6723f1728f30180da26aff9f018f Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Thu, 11 Aug 2022 10:05:32 +0800 Subject: [PATCH] =?UTF-8?q?fix(map):=20=E4=BF=AE=E5=A4=8D=E9=AB=98?= =?UTF-8?q?=E5=BE=B7=E5=9C=B0=E5=9B=BEh5=E7=A7=BB=E5=8A=A8=E7=AB=AFcontrol?= =?UTF-8?q?=E7=82=B9=E5=87=BB=E8=A7=A6=E5=8F=91map=E7=82=B9=E5=87=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/platforms/h5/view/components/map/index.vue | 5 +++++ src/platforms/h5/view/components/map/map-marker.js | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/platforms/h5/view/components/map/index.vue b/src/platforms/h5/view/components/map/index.vue index 479d80d04..bdb0b2604 100644 --- a/src/platforms/h5/view/components/map/index.vue +++ b/src/platforms/h5/view/components/map/index.vue @@ -229,6 +229,10 @@ export default { methods: { handleAMapClick (e) { if (IS_AMAP) { + // The mobile terminal prevent not map click event trigger map click + if (e.target.nodeName !== 'CANVAS') { + return + } const { pageX, pageY } = e.changedTouches[0] this.$trigger('click', { x: pageX, y: pageY }, {}) this.$trigger('tap', { x: pageX, y: pageY }, {}) @@ -611,6 +615,7 @@ export default { style.height = 0 style.top = 0 style.left = 0 + style.zIndex = 999 img.onload = () => { if (option.position.width) { img.width = option.position.width diff --git a/src/platforms/h5/view/components/map/map-marker.js b/src/platforms/h5/view/components/map/map-marker.js index 2677d8818..c7d1a82ff 100644 --- a/src/platforms/h5/view/components/map/map-marker.js +++ b/src/platforms/h5/view/components/map/map-marker.js @@ -127,8 +127,10 @@ export default { longitude }) } - - event.stopPropagation() + // 避开高德地图bug: pc端 stopPropagation 无效且地图随鼠标移动 + if (event !== e.originEvent) { + event.stopPropagation() + } }) // 处理 google H5移动端 maker 点击触发 map 点击问题 maps.event.addListener(marker, 'mousedown', (e) => { @@ -288,7 +290,6 @@ export default { markerId: Number(self.idString) }) } - $event.stopPropagation() } callout = marker.callout = new maps.Callout(calloutStyle, callback, this) } else { -- GitLab