当我尝试在Leaflet弹出窗口中添加按钮时出现问题.单击地图时会生成弹出窗口.
理想情况下,我想popo显示2个按钮:
这个草图是我想要的结果的一个例子:
________________________________________________
|You clicked the map at LatLng(XXXXX,XXXXX) |
| --------------- ------------------- |
| |Start from here| |Go to this location| |
| --------------- ------------------- |
|___________________ ___________________________|
\/
Run Code Online (Sandbox Code Playgroud)
这就是我在popUp中的内容:你在LatLng点击了地图(XXXXX,XXXX)[object HTMLButtonElement]
我正在尝试使用L.domUtil创建按钮
defineYourWaypointOnClick(e: any) {
var choicePopUp = L.popup();
var container = L.DomUtil.create('div'),
startBtn = this.createButton('Start from this location', container),
destBtn = this.createButton('Go to this location', container);
choicePopUp
.setLatLng(e.latlng)
.setContent('You clicked the map at ' + e.latlng.toString() + '<br>' + startBtn)
.openOn(this.map);
L.DomEvent.on(startBtn, 'click', () => …Run Code Online (Sandbox Code Playgroud)