From ba3db6e901ac35e92a8c09f6c9aab4e18acdd7b4 Mon Sep 17 00:00:00 2001 From: 徐旺旺 <11530253@qq.com> Date: 星期二, 12 一月 2021 12:28:12 +0800 Subject: [PATCH] 调整顺序 --- src/components/helpers/BasemapHelper.js | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/helpers/BasemapHelper.js b/src/components/helpers/BasemapHelper.js index d9a0801..60fc9e8 100644 --- a/src/components/helpers/BasemapHelper.js +++ b/src/components/helpers/BasemapHelper.js @@ -50,16 +50,15 @@ * @param layer 寰呮樉绀哄浘灞傚紩鐢� * @param isHideOthers 鏄惁鍏堝叧闂叾浠栧浘灞傦紝榛樿鏄痶rue */ - showBasemap = (code, isHideOthers = true) => { + showBasemap = (code, showAnnotation, isHideOthers = true) => { const basemap = this.basemapMap.get(code) if (isHideOthers) { - for (let i = 0, len = this.basemapList.length; i < len; ++i) { - this.map.removeLayer(this.basemapList[i].layer) - this.map.removeLayer(this.basemapList[i].annotation) - } + this.basemapLayerGroup.clearLayers() } - this.map.addLayer(basemap.layer) - this.map.addLayer(basemap.annotation) + this.basemapLayerGroup.addLayer(basemap.layer) + if (showAnnotation) { + this.basemapLayerGroup.addLayer(basemap.annotation) + } } /** -- Gitblit v1.8.0