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

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

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