From 0c9979075994d553695e1027b0d31566c838aff7 Mon Sep 17 00:00:00 2001
From: wangqi <magical1908@outlook.com>
Date: 星期五, 12 三月 2021 11:32:32 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
src/components/helpers/ServiceLayerHelper.js | 31 ++++++++++++++-----------------
1 files changed, 14 insertions(+), 17 deletions(-)
diff --git a/src/components/helpers/ServiceLayerHelper.js b/src/components/helpers/ServiceLayerHelper.js
index 26bd028..6a2ff71 100644
--- a/src/components/helpers/ServiceLayerHelper.js
+++ b/src/components/helpers/ServiceLayerHelper.js
@@ -140,11 +140,10 @@
* @param res
*/
loadGeojson (res, opt) {
- var that = this
var icon = opt.icon
- const featureGroup = that.L.featureGroup()
+ const featureGroup = this.L.featureGroup()
const featureList = []
- const geojson = that.L.geoJSON(res.features, {
+ const geojson = this.L.geoJSON(res.features, {
style: function (feature) {
return {
fill: styles.defaultLineStyle.fill,
@@ -157,8 +156,8 @@
dashSpeed: styles.defaultLineStyle.dashSpeed
}
},
- pointToLayer: function (geoJsonPoint, latlng) {
- return that.L.canvasMarker(latlng,
+ pointToLayer: (geoJsonPoint, latlng) => {
+ return this.L.canvasMarker(latlng,
{
img: {
// url: 'assets/images/map/marker-icon.png',
@@ -167,21 +166,19 @@
}
})
},
- onEachFeature: function (feature, layer) {
- console.log(feature)
- console.log(layer)
+ onEachFeature: (feature, layer) => {
featureList.push(layer)
- layer.bindPopup(function (layer) {
- that.popupComp.setDatas(layer)
- that.popupComp.setShow()
- return that.popupComp.$el
+ layer.bindPopup((layer) => {
+ this.popupComp.setDatas(layer)
+ this.popupComp.setShow()
+ return this.popupComp.$el
}, {
className: 's-map-popup',
minWidth: 300,
closeButton: false,
autoClose: false
})
- .bindTooltip(function (layer) {
+ .bindTooltip((layer) => {
const nameId = layer.feature.id
let name = ''
if (nameId.indexOf('涓夐��') !== -1 || nameId.indexOf('鍥涢��') !== -1 || nameId.indexOf('绐ㄤ簳') !== -1) {
@@ -194,7 +191,7 @@
}
return name
}, { direction: 'bottom', offset: [0, 15], sticky: true })
- .on('mouseover', function (e) {
+ .on('mouseover', (e) => {
const type = e.target.feature.geometry.type
if (type === 'LineString' || type === 'MultiLineString') {
layer.setStyle({ weight: 8, color: '#00ffff' })
@@ -208,7 +205,7 @@
layer.bringToFront()
}
- }).on('mouseout', function (e) {
+ }).on('mouseout', (e) => {
const type = e.target.feature.geometry.type
if (type === 'LineString' || type === 'MultiLineString') {
layer.setStyle({ weight: styles.defaultLineStyle.weight, color: styles.defaultLineStyle.color })
@@ -225,8 +222,8 @@
}
})
store.commit('addSewersDatas', geojson)
- featureGroup.addTo(that.map)
- that.setZIndex(featureGroup)
+ featureGroup.addTo(this.map)
+ this.setZIndex(featureGroup)
return featureGroup
}
--
Gitblit v1.8.0