L.marker.bindPopup() 的 onpopupload 事件?

onpopupload event for L.marker.bindPopup()?

假设我有这样的代码:

    L.marker({lat: 30.266293, lon: -97.656965}, {icon: myIcon})
        .addTo(mymap)
        .bindPopup("<a href='#' class='test'>click me!</a>");

我希望能够在弹出窗口加载后执行 $('test').click(function() { ... });

我该怎么做?我可以使用某种 onpopupload 事件吗?

是的,图层上有一个事件popupopen

var marker = L.marker({lat: 30.266293, lon: -97.656965}, {icon: myIcon})
        .addTo(mymap)
        .bindPopup("<a href='#' class='test'>click me!</a>");

marker.on('popupopen',(e)=>{
    $('.test').click(function() { ... });
});

PS:点击事件会添加到test元素,必须在test前加一个点,否则找不到元素--> $('.test')