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(); }