我正在将此插件用于一个项目。当我创建弹出窗口时,它们在加载时被激活。我希望它们在用户单击标记时打开。有什么帮助吗?const mymap = L.map('mapid').setView([40.399245, 49.876386], 10);const tile = L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}', { attribution: 'Map data © <a href="https://www.mapbox.com/">Mapbox</a>', maxZoom: 18, id: 'mapbox.streets', accessToken: 'TOKEN'}).addTo(mymap);const mapIcon = L.icon({ iconUrl: 'assets/image/icons/marker.png', iconSize: [40, 40], iconAnchor: [20, 20]})const marker = L.marker([40.399245, 49.876386], { icon: mapIcon }).addTo(mymap);const marker = L.marker([40.399245, 49.876386], { icon: mapIcon }).addTo(mymap);var popup = L.popup({}).setContent('content')marker.bindPopup(popup).openPopup();marker.setLatLng([40.399245, 49.876386]).addTo(mymap);
添加回答
举报
0/150
提交
取消