单击标记时,我需要执行一些代码,找到id与被单击的标记对应的代码,从后端API检索数据,然后将新检索的数据添加到content将打开的弹出窗口中.
能够在标记上收听点击事件的唯一方法是
map.on('popupopen', function(e){
// How to retrieve marker?
// eg: Assign an id on creation, retrieve it now during popupopen
};)
Run Code Online (Sandbox Code Playgroud)
我怎样才能找出这是哪个标记?是否可以为id每个标记添加属性,然后id在popupopen事件期间检索它?