我找到了可以在我正在工作的Leaflet项目中使用的功能。该函数是用ES6编写的,在Firefox和Chrome中都可以很好地工作。但是,我也需要定位IE。在我的研究中,我发现IE目前不接受ES6箭头功能。我还发现,如果将ES6函数转换为ES5,该函数将在IE中工作。几天来,我试图将以下功能转换为ES5,但没有成功。我尝试过的一些解决方案在此处发布。可以请一些人看看我的剧本,让我知道我在做什么错。同样,ES6的好处是什么?较短的脚本?先感谢您。
这是有效的ES6脚本:
points.map((p, i) => L.marker(p).bindPopup(`marker${'<strong>' + pointData[i].cityName + '</strong>' + ', ' + '</br>' + pointData[i].discrip + "<br /><a class='fancybox-thumb' ' style='width:150px;' rel='fancybox-button' rel='fancybox-thumb' data-fancybox-group='"+ pointData[i].popup +"' title='" + pointData[i].discrip + " ' href='graphic/"+ pointData[i].popup + "' ><img src='graphic/" + pointData[i].popup + "' alt='Image' ' style='width:150px;' ></a>" + "<br/><a href='http://www.google.com' target='_blank'>Cedellion Report</a>"}`))
.forEach(function(marker) {
map.addLayer(marker);
oms.addMarker(marker);
});
Run Code Online (Sandbox Code Playgroud)
这是我最好的尝试/猜测,没有喜悦。
points.map(function(p, i) {
L.marker(p).bindPopup(`marker${'<strong>' + pointData[i].cityName + '</strong>' + ', ' + '</br>' + pointData[i].discrip + "<br /><a class='fancybox-thumb' ' style='width:150px;' …Run Code Online (Sandbox Code Playgroud)