Skip to content

Commit 7449de0

Browse files
author
Nicolò Maria Mezzopera
committed
feat: destroy map on beforeDestroy to prevent memory leak
1 parent b498e96 commit 7449de0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/components/LMap.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ export default {
131131
return options;
132132
}
133133
},
134+
beforeDestroy () {
135+
if (this.mapObject) {
136+
this.mapObject.remove();
137+
}
138+
},
134139
mounted () {
135140
const options = optionsMerger({
136141
minZoom: this.minZoom,

0 commit comments

Comments
 (0)