提交 f8bfec19 编写于 作者: L liyongning

upd: 移除 polygon 的点击事件(兼容微信小程序)

上级 2e630f44
......@@ -42,7 +42,7 @@ import {
} from './maps'
import mapMarker from './map-marker'
import mapPolygon from './map-polygon/index'
import mapPolygon from './map-polygon'
import { ICON_PATH_ORIGIN } from '../../../helpers/location'
......
import { hexToRgba } from 'uni-shared'
import { listenEvent } from './event'
export default {
props: {
......@@ -130,9 +129,6 @@ export default {
// 说明是新增区域
this.polygonIns = new _maps.Polygon(polygonOptions)
// 监听事件,当对应事件发生时,将事件暴露给用户
listenEvent(_maps, this.polygonIns, this.$parent.$trigger)
}
},
// 卸载时清除地图上绘制的 polygon
......
const { assign, create } = Object
// 事件对象,以腾讯原生事件名为 key,对外暴露的对应事件名为 value
export const eventObj = assign(create(null), {
// 点击此多边形后会触发此事件
click: 'polygontap'
})
/**
* 监听事件,当对应事件发生时,将事件暴露给用户
*/
export function listenEvent (
maps,
polygonIns,
trigger
) {
for (const key in eventObj) {
maps.event.addDomListener(polygonIns, key, function (e) {
// 要对外暴露的事件
const eVal = eventObj[key]
e ? trigger(eVal, {}, e) : trigger(eVal, {})
})
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册