跟随传单弹出窗口内的链接

6tqwzwtp  于 2021-09-13  发布在  Java
关注(0)|答案(0)|浏览(202)

我有一张传单Map,上面的标记是使用geojson获得的。我想将geojson中的文本添加到弹出窗口中,并使其成为链接。当你点击链接时,链接应该转到这个链接。但是转换没有发生,并且控制台中的错误:UncaughtReferenceError:bindpopup没有定义。

var countiesAll = $.ajax({
            url: "{% url 'api_master_around' id=master.id %}",
            dataType: "json",
            success: console.log("County data successfully loaded countiesAll."),
            error: function (xhr) {
                alert(xhr.statusText)
            }
        })
var map = L.map('map', {
                center: [51.505, -0.09],
                zoom: 14
            })
            setInterval(function () {
                map.invalidateSize();
            }, 100);
            L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png?{foo}', {
                foo: 'bar',
                attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
            }).addTo(map);
 L.geoJSON(countiesAll.responseJSON, {
                pointToLayer: function (feature, latlng) {
                    return L.marker(latlng, {icon: iconBlack})
                }
            }).bindPopup(function (layer) {
                var popup = layer.feature.properties.name
                return `<a href = "http://{{ s.myCountry.nameCountry_for_sites_full }}:8000/{{ request.default_lang }}/{{ s.myCity_base }}/{{ z.pk }}"> ${popup} </a> `
            }).addTo(map);

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题