diff --git a/src/views/oneMap/components/ZTGL.vue b/src/views/oneMap/components/ZTGL.vue index 796f6da..73cecf7 100644 --- a/src/views/oneMap/components/ZTGL.vue +++ b/src/views/oneMap/components/ZTGL.vue @@ -67,8 +67,10 @@ }, 100); }); onBeforeUnmount(() => { - newfiberMapbox.removeLayer(newfiberMapbox.getLayerByName('testProjection')); - mapBoxVectorLayer.removeByIds(['testProjection']); + if (newfiberMapbox.getLayerByName('testProjection')) { + newfiberMapbox.removeLayer(newfiberMapbox.getLayerByName('testProjection')); + mapBoxVectorLayer.removeByIds(['testProjection']); + } });