我想在我的地图中添加一条折线,但似乎无法让它在按钮单击时呈现。这是我目前拥有的代码:
<button onClick={
function(){
console.log(asset.past);
var pathLine = new L.Polyline(asset.past, {
color: 'red',
weight: 3,
opacity: 0.5,
smoothFactor: 1
}
);
leafletMap.addLayer(pathLine);}
}
className="btn btn-info eachBtn">Go</button>
谢谢,埃德。