Skip to content

Commit 4cd87a7

Browse files
committed
fix unbind tooltip and popup
1 parent 49bb046 commit 4cd87a7

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/components/LPopup.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,13 @@ export default {
2929
});
3030
},
3131
beforeDestroy () {
32-
if (this.parentContainer && this.parentContainer.mapObject) {
33-
this.parentContainer.mapObject.unbindPopup();
32+
if (this.parentContainer) {
33+
if (this.parentContainer.unbindPopup) {
34+
this.parentContainer.unbindPopup();
35+
} else if (this.parentContainer.mapObject
36+
&& this.parentContainer.mapObject.unbindPopup) {
37+
this.parentContainer.mapObject.unbindPopup();
38+
}
3439
}
3540
}
3641
};

src/components/LTooltip.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ export default {
2020
});
2121
},
2222
beforeDestroy () {
23-
if (this.parentContainer && this.parentContainer.mapObject) {
24-
this.parentContainer.mapObject.unbindTooltip();
23+
if (this.parentContainer) {
24+
if (this.parentContainer.unbindTooltip) {
25+
this.parentContainer.unbindTooltip();
26+
} else if (this.parentContainer.mapObject
27+
&& this.parentContainer.mapObject.unbindTooltip) {
28+
this.parentContainer.mapObject.unbindTooltip();
29+
}
2530
}
2631
}
2732
};

0 commit comments

Comments
 (0)