fix(popup): popup react 自定事件不生效

This commit is contained in:
thinkinggis 2020-09-07 17:30:43 +08:00
parent 19daa4d5c5
commit 64652bcae3
1 changed files with 10 additions and 7 deletions

View File

@ -214,13 +214,16 @@ export default class Popup extends EventEmitter implements IPopup {
}
// 高德地图需要阻止事件冒泡 // 测试mapbox 地图不需要添加
['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(
(type) => {
this.container.addEventListener(type, (e) => {
e.stopPropagation();
});
},
);
const { stopPropagation} = this.popupOption;
if(stopPropagation) {
['mousemove', 'mousedown', 'mouseup', 'click', 'dblclick'].forEach(
(type) => {
this.container.addEventListener(type, (e) => {
e.stopPropagation();
});
},
);
}
}
if (maxWidth && this.container.style.maxWidth !== maxWidth) {
this.container.style.maxWidth = maxWidth;