简体   繁体   English

单张ID属性

[英]Leaflet id properties

How do I assign id tags to leaflet polylines so that I can show/hide or do other operations on them later? 如何为传单折线分配ID标签,以便以后可以显示/隐藏或对其进行其他操作? I'll have around 100+ polylines. 我将有大约100条以上的折线。 Is there a way I can set an id property to it? 有没有一种方法可以为其设置id属性?

Also I noticed the leaflet module has a leaflet-src.js file in it. 我也注意到Leaflet模块中有一个leaflet-src.js文件。 Can I add the property to the L.Polyline using this.ident and add it while constructing the polyline in the html file? 我可以使用this.ident将属性添加到L.Polyline并在html文件中构造折线时添加它吗?

When you create a new L.Polyline , you can add a id key to the options hash which you can then operate on/inspect later while looping through the featureGroup or other more vanilla JavaScript grouping that contains it. 创建新的L.Polyline ,可以将id键添加到options哈希中,然后在以后遍历featureGroup或包含它的其他更普通的JavaScript分组时可以对其进行操作/检查。

http://leafletjs.com/reference.html#polyline-l.polyline http://leafletjs.com/reference.html#polyline-l.polyline

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM