【GIS】Leaflet要素信息及事件处理

onEachFeatureFlashForGeoJson(feature, layerObject) {
        let that = this;
        var elements = "";
        let i = 0;
        let properties = feature.properties;
        for (var item in properties) {
          let name = item;
          let value = properties[name];
          if (window.hideFields.indexOf(name) < 0 && value != null) {
            i++;
            if (i > 20) {
              break;
            }
            elements = elements + name + ":" + value + "<br>"
          }
        }
        if (elements != "") {
          layerObject.bindPopup(elements);
        } else {
          console.log("没有属性信息!")
        }
        layerObject.on({
          mouseover: this.highlightFeature,
          mouseout: this.resetHighlight,
          click: this.zoomToFeature
        }); 
      },
博客地址: http://www.cnblogs.com/defineconst/
博客版权: 本文以学习、研究和分享为主,欢迎转载和各类爬虫,但必须在文章页面明显位置给出原文链接。 如果文中有不妥或者错误的地方还望高手的您指出,以免误人子弟。如果您有更好的建议,不如留言一起讨论,共同进步! 再次感谢您耐心的读完本篇文章。
原文地址:https://www.cnblogs.com/defineconst/p/14980097.html