Openlayers 5将不再显示OSM地图 我尝试从ol.source.OSM()添加,但显示了灰色地图。
var map3 = new ol.Map({
layers: new ol.layer.Tile({
source: new ol.source.OSM()
}) ,
target: 'map-id3',
view: new ol.View({
center:ol.proj.fromLonLat([10.74,34.77]),
zoom:12
})
});
答案 0 :(得分:0)
layers
必须是数组
layers: [ new ol.layer.Tile({
source: new ol.source.OSM()
}) ],