首页 > 解决方案 > 传单弹出框问题 - 框角上的小标签。这是某种故障吗?

问题描述

我最近设置了一张传单地图,点击时会弹出工具提示。我认为一切都很完美,直到有人指出每个弹出框的右下角都有这个奇怪的标签(见下图)。

知道是什么原因造成的吗?

这是弹出窗口的代码:

function popUp (feature, layer) {
   layer.bindPopup("<h1 class='city_infoheader'>" + feature.properties.city + " </h1><p>PM2.5 Attributable COPD Deaths: "+Math.round(feature.properties.copd) + "</p>");
   layer.setIcon(circle);
};

function PoppopUp (feature, layer) {
   layer.bindPopup("<h1 class='infoheader'>"+feature.properties.admin+" </h1><p>Country Population: "+feature.properties.pop_est+"</p>");
}; 

var pmDeaths = new L.geoJson(pmDeaths,{
    onEachFeature: popUp,
}).addTo(mymap);

var countryPop = new L.geoJson(countryPop,{
    style:countryColor,
    onEachFeature: PoppopUp,
}).addTo(mymap);

标签: javascriptcssleafletmaps

解决方案


我有同样的问题。如果除了已经包含传单的库(例如,mapbox)之外还包含leaflet.css,则可能存在样式定义的重复/冲突,这将导致弹出提示出现此问题。解决方案是从您的构建中删除leaflet.css。


推荐阅读