添加新控件后传单地图不起作用
Leaflet map doesn’t work after adding a new control
添加后 Leaflet.MousePosition 我的地图没有显示。
var lmap = new L.map("lmap", {
zoomControl: false,
maxZoom: 11,
minZoom: 3,
}).setView([34.543896, 63.160652], 6);
L.control.zoom({
position: 'topright'
}).addTo(lmap);
lmap.addControl(new L.Control.Fullscreen({position: 'bottomleft'}));
L.control.mousePosition({position: 'bottomright'}).addTo(lmap);
您正在使用 map
但您必须使用 lmap
L.control.mousePosition({position: 'bottomright'}).addTo(lmap);
您还必须将库 src 添加到您的项目中。
将以下内容添加到您的 html 文件中:
<script src="https://cdn.jsdelivr.net/npm/leaflet-mouse-position@1.2.0/src/L.Control.MousePosition.min.js"></script>
添加后 Leaflet.MousePosition 我的地图没有显示。
var lmap = new L.map("lmap", {
zoomControl: false,
maxZoom: 11,
minZoom: 3,
}).setView([34.543896, 63.160652], 6);
L.control.zoom({
position: 'topright'
}).addTo(lmap);
lmap.addControl(new L.Control.Fullscreen({position: 'bottomleft'}));
L.control.mousePosition({position: 'bottomright'}).addTo(lmap);
您正在使用 map
但您必须使用 lmap
L.control.mousePosition({position: 'bottomright'}).addTo(lmap);
您还必须将库 src 添加到您的项目中。
将以下内容添加到您的 html 文件中:
<script src="https://cdn.jsdelivr.net/npm/leaflet-mouse-position@1.2.0/src/L.Control.MousePosition.min.js"></script>