From 5f98655fb83417d58a1ec0b88eec3900fc15dcce Mon Sep 17 00:00:00 2001 From: chenzeping <ChenZeping02609@163.com> Date: 星期二, 30 三月 2021 17:26:50 +0800 Subject: [PATCH] Merge branch 'develop' of http://xearth.cn:6600/r/wuyushui/SewerAndRainNetwork into develop --- src/components/LayerController/service/WfsLayerService.js | 14 +++++++++----- 1 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/LayerController/service/WfsLayerService.js b/src/components/LayerController/service/WfsLayerService.js index e5a175d..8d55234 100644 --- a/src/components/LayerController/service/WfsLayerService.js +++ b/src/components/LayerController/service/WfsLayerService.js @@ -21,15 +21,20 @@ } init (layer) { + this.layer = layer const wfsUrl = this.config.wfs if (wfsUrl) { - AjaxUtils.get4JsonDataByUrl(wfsUrl, this.params, (res) => this.draw(layer, res.data.features)) + this.loadData(wfsUrl) } } - draw (layer, features) { + loadData (wfsUrl) { + AjaxUtils.get4JsonDataByUrl(wfsUrl, this.params, (res) => this.draw(res.data.features)) + } + + draw (features) { const icon = this.config.icon - const geojson = this.L.geoJSON(features, { + this.L.geoJSON(features, { style: function (feature) { return { fill: styles.defaultLineStyle.fill, @@ -66,8 +71,7 @@ .bindTooltip((layer) => this.tooltipListener(layer), { direction: 'bottom', offset: [0, 15], sticky: true }) .on('mouseover', (e) => this.mouseOverListener(e, layer)).on('mouseout', (e) => this.mouseOutListener(e, layer)) } - }).addTo(layer) - return geojson + }).addTo(this.layer) } mouseOverListener (e, layer) { -- Gitblit v1.8.0