From 4fa5a324db648495703541097ee522a10a82c1c5 Mon Sep 17 00:00:00 2001 From: heiyexing <496845051@qq.com> Date: Tue, 13 Dec 2022 10:07:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20isOpen=20=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98=20(#1537)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * docs: 场景 Scene API 补充 addPopup 和 removePopup 方法说明 * fix: 修复 Popup title 设置先后问题 * fix: 修复 L7 Popup isOpen 报错问题 Co-authored-by: yanxiong --- packages/component/src/marker.ts | 2 +- packages/component/src/popup/popup.ts | 2 +- packages/core/src/services/component/PopupService.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/component/src/marker.ts b/packages/component/src/marker.ts index a6f0d97beb..8f0cf360e7 100644 --- a/packages/component/src/marker.ts +++ b/packages/component/src/marker.ts @@ -346,7 +346,7 @@ export default class Marker extends EventEmitter { lngLat: this.lngLat, }); }; - + // eslint-disable-next-line @typescript-eslint/no-unused-vars private addDragHandler(e: MouseEvent) { return null diff --git a/packages/component/src/popup/popup.ts b/packages/component/src/popup/popup.ts index b99665e1c5..cd7c1bb4c4 100644 --- a/packages/component/src/popup/popup.ts +++ b/packages/component/src/popup/popup.ts @@ -134,7 +134,7 @@ export default class Popup // 移除popup public remove() { - if (!this.isOpen()) { + if (!this?.isOpen()) { return; } diff --git a/packages/core/src/services/component/PopupService.ts b/packages/core/src/services/component/PopupService.ts index 8c2447bf60..d72320734f 100644 --- a/packages/core/src/services/component/PopupService.ts +++ b/packages/core/src/services/component/PopupService.ts @@ -16,7 +16,7 @@ export default class PopupService implements IPopupService { } public removePopup(popup: IPopup): void { - if (popup.isOpen()) { + if (popup?.isOpen()) { popup.remove(); }