0
好的,我有一个GeoJSON点文件,我正在阅读Leaflet。我注意到bindPopup读取记录编号(feature.properties.Record/Label),但是我无法使bindLabel读取它。如果我删除feature.properties.Record并将其替换为“Demo”,那么我会得到一个标签。单张标签不读取geojson
onEachFeature: function (feature, layer) {
layer.bindPopup("<p>Record: " + feature.properties.Record + "</p>"), //works
//layer.bindLabel(feature.properties['Record'], { noHide:true, className: 'text-labels' }), //Doesn't work
//layer.bindLabel(feature.properties.Record, { noHide:true, className: 'text-labels' }), //Doesn't work
layer.bindLabel('Hello', { noHide:true, className: 'text-labels' }), //works but I don't want to manually label each one.
layer.addTo(map).
layer.showLabel();
任何想法?我试过提示选项,但我得到的bindtooltip不是一个函数。