From b839ef68a65fdc9a3b00ce0855c97679aec10d1d Mon Sep 17 00:00:00 2001 From: YANGDL <114714267@qq.com> Date: 星期三, 10 三月 2021 09:05:47 +0800 Subject: [PATCH] 修复ie下不能显示的问题 --- src/components/helpers/ServiceLayerHelper.js | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/helpers/ServiceLayerHelper.js b/src/components/helpers/ServiceLayerHelper.js index 96da67f..8d1ab87 100644 --- a/src/components/helpers/ServiceLayerHelper.js +++ b/src/components/helpers/ServiceLayerHelper.js @@ -143,7 +143,8 @@ loadGeojson (res, opt) { var that = this var icon = opt.icon - const layergroup = that.L.featureGroup().addTo(that.map) + const featureGroup = that.L.featureGroup().addTo(that.map) + const featureList = [] const geojson = that.L.geoJSON(res.features, { style: function (feature) { return { @@ -152,9 +153,9 @@ fillColor: styles.defaultLineStyle.fillColor, color: styles.defaultLineStyle.color, fillOpacity: styles.defaultLineStyle.fillOpacity, - opacity: styles.defaultLineStyle.opacity - // dashArray: styles.defaultLineStyle.dashArray, - // dashSpeed: styles.defaultLineStyle.dashSpeed + opacity: styles.defaultLineStyle.opacity, + dashArray: styles.defaultLineStyle.dashArray, + dashSpeed: styles.defaultLineStyle.dashSpeed } }, pointToLayer: function (geoJsonPoint, latlng) { @@ -166,6 +167,10 @@ size: styles.defaultLineStyle.size } }) + }, + onEachFeature: function (feature, layer) { + featureList.push(layer) + layer.addTo(featureGroup) } }).bindPopup(function (layer) { that.popupComp.setDatas(layer) @@ -220,7 +225,8 @@ }) } // }).addTo(that.map) - }).addTo(layergroup) + // }).addTo(featureGroup) + }) store.commit('addSewersDatas', geojson) if (Object.prototype.hasOwnProperty.call(res, 'features') && res.features.length > 0 && (res.features[0].geometry.type === 'LineString' || res.features[0].geometry.type === 'MultiLineString')) { geojson.bringToBack() -- Gitblit v1.8.0