如何为传单标记工具添加带有事件的多个按钮

问题描述

我想添加更多按钮以及此取消按钮,当用户从传单工具栏单击标记时。请向我建议解决方案或任何有助于实现此要求的插件

enter image description here

解决方法

您可以使用插件Leaflet-Geoman

function onclick(e){
    console.log('CLICK')
}

// add a new custom control
map.pm.Toolbar.createCustomControl({
  name: 'CustomButton',block: 'draw',className: 'control-icon leaflet-pm-icon-marker',actions: [{
    text: 'Cancel',onClick: onclick 
  }]
})

转到custom button doc,然后滚动到添加新的/自定义控件

示例:https://jsfiddle.net/falkedesign/6x9cknft/