传单-如何在弹出窗口中同时显示照片和URL?

传单-如何在弹出窗口中同时显示照片和URL?,url,leaflet,photo,Url,Leaflet,Photo,我在组合代码以在弹出窗口中显示照片和URL时遇到问题。理想情况下,我希望照片链接到URL,因此单击它会将访问者带到URL页面 到目前为止,这是我为他们单独编写的代码: **URL**: if (feature.properties.url) { html += '<a href="' + feature.properties.url + '" target="_blank">Site Internet</a>

我在组合代码以在弹出窗口中显示照片和URL时遇到问题。理想情况下,我希望照片链接到URL,因此单击它会将访问者带到URL页面

到目前为止,这是我为他们单独编写的代码:

**URL**:
                if (feature.properties.url) {
                html += '<a href="' + feature.properties.url + '"  target="_blank">Site Internet</a></br>';
            }

 **PHOTO**:
                if (feature.properties.picture) {
                html += '<img src="'+ feature.properties.picture +'" style="width:200px;height:200px;">'+ '</br>';
            } 
有人能告诉我如何将这两个命令结合起来吗?
谢谢你的帮助

如果图片存在,则将图片显示为指向url的链接。您可以添加更多的逻辑来满足不存在的URL

    if (feature.properties.url) {
        html += '<a href="' + feature.properties.url + '"  target="_blank">';

        if (feature.properties.picture) {
                    html += '<img src="'+ feature.properties.picture +'" style="width:200px;height:200px;">'+ '</a></br>';
        } 
        else {  
             html += 'Site Internet</a></br>';
         }
    }