전단지에서 루프 (eachLayer)를 종료하려면 어떻게해야합니까?각 층 전단지를 어기는 방법 은요?
break
과 return
을 시도했지만 작동하지 않았습니다. 다음은
var bounds = map.getBounds();
var notInBounds = true;
markers.eachLayer(function(marker) {
if (bounds.contains(marker.getLatLng())) {
notInBounds = false;
break;
}
});
2017 년 1 월을 기준으로 답변이 업데이트되었으므로 루프를 벗어나는'eachLayer'에서'false;를 반환 할 수 있습니다. – jamez14