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不是一個函數。