提交 b0650ad0 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

refactor(h5 map): 统一map click trigger触发(取消冒泡方式)

上级 2b5e7796
......@@ -3,7 +3,6 @@
:id="id"
ref="mapContainer"
v-on="$listeners"
@touchend="handleAMapClick"
>
<map-marker
v-for="item in markers"
......@@ -18,6 +17,7 @@
<div
ref="map"
style="width: 100%; height: 100%; position: relative; overflow: hidden"
@click.stop
/>
<div
style="
......@@ -227,16 +227,6 @@ export default {
this.removeLocation()
},
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('tap', { x: pageX, y: pageY }, {})
}
},
_handleSubscribe ({
type,
data = {}
......@@ -409,6 +399,9 @@ export default {
this.isBoundsReady = true
this.$emit('boundsready')
})
maps.event.addListener(map, 'click', (e) => {
this.$trigger('click', {}, {})
})
maps.event.addListener(map, 'dragstart', () => {
this.$trigger('regionchange', {}, {
type: 'begin',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册