Fix hot-reloading Map component

This commit is contained in:
James Lyne 2021-05-28 19:50:08 +01:00
parent 54742f90f9
commit 387c92e3cb

View File

@ -16,6 +16,7 @@
<template>
<div class="map" :style="{backgroundColor: mapBackground }" v-bind="$attrs" :aria-label="mapTitle">
<template v-if="leaflet">
<MapLayer v-for="[name, map] in maps" :key="name" :map="map" :name="name" :leaflet="leaflet"></MapLayer>
<PlayersLayer v-if="playerMarkersEnabled" :leaflet="leaflet"></PlayersLayer>
<MarkerSetLayer v-for="[name, markerSet] in markerSets" :key="name" :markerSet="markerSet" :leaflet="leaflet"></MarkerSetLayer>
@ -25,6 +26,7 @@
<LinkControl v-if="linkControlEnabled" :leaflet="leaflet"></LinkControl>
<ClockControl v-if="clockControlEnabled" :leaflet="leaflet"></ClockControl>
<ChatControl v-if="chatBoxEnabled" :leaflet="leaflet"></ChatControl>
</template>
</div>
<MapContextMenu :leaflet="leaflet" v-if="leaflet"></MapContextMenu>
</template>
@ -225,6 +227,7 @@ export default defineComponent({
unmounted() {
window.removeEventListener('keydown', this.handleKeydown);
this.leaflet.remove();
},
methods: {