【问题标题】:Leaflet map shows grey areas even the layer is added即使添加了图层,传单地图也会显示灰色区域
【发布时间】:2020-11-10 18:03:44
【问题描述】:

我的传单地图显示灰色瓷砖。我也添加了图层。 This is how it shows

<div class="col-md-5">
   <div id="mainMap" style="height: 400px"></div>
</div>

const mainMap = new L.map("mainMap", {
    doubleClickZoom: false,
    zoomControl: false,
}).setView([34.543896, 64.160652], 6);
const osm = L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
        maxZoom: 6,
        attribution:
            '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
    });
    mainMap.addLayer(osm);

【问题讨论】:

标签: javascript html css leaflet


【解决方案1】:

记得包含 CSS 文件:

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
   integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
   crossorigin=""
/>

这应该适合你。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-02-19
    • 1970-01-01
    • 1970-01-01
    • 2016-12-10
    • 1970-01-01
    • 1970-01-01
    • 2019-04-07
    • 1970-01-01
    相关资源
    最近更新 更多