Leaflet 如果地图中未调用setView,则它不会';不显示地图?

Leaflet 如果地图中未调用setView,则它不会';不显示地图?,leaflet,Leaflet,下面的第一个代码段不显示映射 片段1: var mapEle = document.getElementById('map'); var map = L.map(mapEle); L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { attribution: '&copy; <a href="http://osm.org/copyright" title="Op

下面的第一个代码段不显示映射

片段1:

var mapEle = document.getElementById('map');        
var map = L.map(mapEle);
L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
          attribution: '&copy; <a href="http://osm.org/copyright" title="OpenStreetMap" target="_blank">OpenStreetMap</a> contributors | Tiles Courtesy of <a href="http://www.mapquest.com/" title="MapQuest" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png" width="16" height="16">',
          subdomains: ['otile1','otile2','otile3','otile4']     
        }).addTo(map);
var mapEle=document.getElementById('map');
var map=L.map(mapEle);
L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png'{
归属:“©;贡献者|由”,
子域:['otile1','otile2','otile3','otile4']
}).addTo(地图);
片段2:

var mapEle = document.getElementById('map');        
var map = L.map(mapEle).setView([43.07265,-89.400929], 10);
L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
          attribution: '&copy; <a href="http://osm.org/copyright" title="OpenStreetMap" target="_blank">OpenStreetMap</a> contributors | Tiles Courtesy of <a href="http://www.mapquest.com/" title="MapQuest" target="_blank">MapQuest</a> <img src="http://developer.mapquest.com/content/osm/mq_logo.png" width="16" height="16">',
          subdomains: ['otile1','otile2','otile3','otile4']     
        }).addTo(map);
var mapEle=document.getElementById('map');
var-map=L.map(mapEle).setView([43.07265,-89.400929],10);
L.tileLayer('http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png'{
归属:“©;贡献者|由”,
子域:['otile1','otile2','otile3','otile4']
}).addTo(地图);
在第一个代码段的第二行进行了更改,添加了
setView([43.07265,-89.400929],10)
,它显示地图,我是否缺少什么,或者setView是必需的

更新

传单版本:0.7.3

使用setView(),您可以告诉传单必须从服务器中获取哪些磁贴http://{s}.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png

因此,是的,它是强制性的

是的,setView()是强制性的。同样的情况也发生在我身上。然后我在谷歌上搜索,知道setView()是强制性的。否则地图不会加载。