久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='amDTB'></tfoot>

<i id='amDTB'><tr id='amDTB'><dt id='amDTB'><q id='amDTB'><span id='amDTB'><b id='amDTB'><form id='amDTB'><ins id='amDTB'></ins><ul id='amDTB'></ul><sub id='amDTB'></sub></form><legend id='amDTB'></legend><bdo id='amDTB'><pre id='amDTB'><center id='amDTB'></center></pre></bdo></b><th id='amDTB'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='amDTB'><tfoot id='amDTB'></tfoot><dl id='amDTB'><fieldset id='amDTB'></fieldset></dl></div>

    <bdo id='amDTB'></bdo><ul id='amDTB'></ul>

  1. <small id='amDTB'></small><noframes id='amDTB'>

  2. <legend id='amDTB'><style id='amDTB'><dir id='amDTB'><q id='amDTB'></q></dir></style></legend>

    1. 傳單:找不到地圖容器

      Leaflet: Map container not found(傳單:找不到地圖容器)
    2. <legend id='ngHjH'><style id='ngHjH'><dir id='ngHjH'><q id='ngHjH'></q></dir></style></legend>

      • <bdo id='ngHjH'></bdo><ul id='ngHjH'></ul>

        • <tfoot id='ngHjH'></tfoot>
            <tbody id='ngHjH'></tbody>

                <i id='ngHjH'><tr id='ngHjH'><dt id='ngHjH'><q id='ngHjH'><span id='ngHjH'><b id='ngHjH'><form id='ngHjH'><ins id='ngHjH'></ins><ul id='ngHjH'></ul><sub id='ngHjH'></sub></form><legend id='ngHjH'></legend><bdo id='ngHjH'><pre id='ngHjH'><center id='ngHjH'></center></pre></bdo></b><th id='ngHjH'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='ngHjH'><tfoot id='ngHjH'></tfoot><dl id='ngHjH'><fieldset id='ngHjH'></fieldset></dl></div>

                <small id='ngHjH'></small><noframes id='ngHjH'>

                本文介紹了傳單:找不到地圖容器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                限時送ChatGPT賬號..

                我有下面的反應類,它通過瀏覽器獲取地理位置.

                I have the below react class which fetches the geolocation through the browser.

                我正在繪制一張傳單地圖.我想將地理位置作為 setView 的輸入,以便地圖縮放"到客戶端瀏覽器位置的區域.

                I am mapping a leaflet map. I want to geolocation to be an input to the setView, for such that the map "zooms" into the region of the client browser location.

                這是反應類:

                    import React from 'react';
                    import L from 'leaflet';
                    import countries from './countries.js'; 
                
                    var Worldmap = React.createClass({
                
                        render: function() {
                
                            let geolocation = [];
                
                            navigator.geolocation.getCurrentPosition(function(position) {
                                let lat = position.coords.latitude;
                                let lon = position.coords.longitude;
                                geolocation.push(lat, lon);
                                locationCode()
                            });
                
                            function locationCode() {
                                if(geolocation.length <= 0)
                                    geolocation.push(0, 0);
                            }
                
                
                            let map = L.map('leafletmap').setView(geolocation, 3);
                
                            L.geoJSON(countries, {
                                style: function(feature) {
                                    return {
                                        fillColor: "#FFBB78",
                                        fillOpacity: 0.6,
                                        stroke: true,
                                        color: "black",
                                        weight: 2
                                    };
                                }
                            }).bindPopup(function(layer) {
                                return layer.feature.properties.name;
                            }).addTo(map);
                
                            return (
                                <div id="leafletmap" style={{width: "100%", height: "800px" }}/>
                            )
                        }
                    });
                
                    export default Worldmap
                

                在 HTML 呈現為 <WorldMap/> 的主文件中調用它.

                It's called in a main file where the HTML is rendered as <WorldMap />.

                我在加載頁面時收到錯誤 Uncaught Error: Map container not found..環顧四周,通常是因為地圖在提供值之前試圖在 div 中顯示(在這種情況下為 (gelocation, 3)).但是,它不應該在從下面的渲染函數返回之前顯示它.

                I get the error Uncaught Error: Map container not found. when loading the page. Looking around, usually it would be because the map is trying to be displayed in a div before being provided values((gelocation, 3) in this case). However, it shouldn't display it before being returned from the render function below.

                可能是什么問題?

                在控制臺中打印出 geolocation 可以正確獲取坐標,因此這似乎不是問題.

                Printing out the geolocation in the console correctly fetches the coordinates, so that doesn't seem to be the issue.

                推薦答案

                <div id="leafletmap"> 必須添加到dom before 調用 L.map('leafletmap').

                The <div id="leafletmap"> must be added to the dom before calling L.map('leafletmap').

                這篇關于傳單:找不到地圖容器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Browserify, Babel 6, Gulp - Unexpected token on spread operator(Browserify,Babel 6,Gulp - 傳播運算符上的意外令牌)
                Is it possible to pass a flag to Gulp to have it run tasks in different ways?(是否可以將標志傳遞給 Gulp 以使其以不同的方式運行任務?)
                Why do we need to install gulp globally and locally?(為什么我們需要在全局和本地安裝 gulp?)
                How to run Gulp tasks sequentially one after the other(如何一個接一個地依次運行 Gulp 任務)
                Visual Studio 2015 crashes when opening Javascript files(打開 Javascript 文件時 Visual Studio 2015 崩潰)
                Detect FLASH plugin crashes(檢測 FLASH 插件崩潰)

                  <small id='C4nmA'></small><noframes id='C4nmA'>

                    <tbody id='C4nmA'></tbody>

                    <legend id='C4nmA'><style id='C4nmA'><dir id='C4nmA'><q id='C4nmA'></q></dir></style></legend>
                  • <i id='C4nmA'><tr id='C4nmA'><dt id='C4nmA'><q id='C4nmA'><span id='C4nmA'><b id='C4nmA'><form id='C4nmA'><ins id='C4nmA'></ins><ul id='C4nmA'></ul><sub id='C4nmA'></sub></form><legend id='C4nmA'></legend><bdo id='C4nmA'><pre id='C4nmA'><center id='C4nmA'></center></pre></bdo></b><th id='C4nmA'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='C4nmA'><tfoot id='C4nmA'></tfoot><dl id='C4nmA'><fieldset id='C4nmA'></fieldset></dl></div>

                        <tfoot id='C4nmA'></tfoot>
                        • <bdo id='C4nmA'></bdo><ul id='C4nmA'></ul>
                          主站蜘蛛池模板: 黄色永久免费 | 免费观看一级毛片 | 日韩欧美一区在线 | 亚洲成人av在线播放 | 一区二区视屏 | 天堂亚洲网 | 久久精品91 | 久久综合久久综合久久综合 | 国内自拍偷拍视频 | 欧美一级全黄 | 在线成人av | 国产91久久精品一区二区 | 国产一区二区三区 | 一区二区三区在线播放 | 精品久久99| 一区二区三区免费 | 精品国产视频 | 精品欧美一区二区三区精品久久 | 99re在线视频| 在线视频国产一区 | 欧美日韩不卡合集视频 | 综合久| 国产乱码精品一区二区三区中文 | 韩国久久 | 国产精品国产a级 | 国产精品久久久久久久久污网站 | 日本在线免费看最新的电影 | 夜夜爽99久久国产综合精品女不卡 | av在线播放网站 | 国产精品永久在线观看 | 国产精品久久久久久吹潮 | 久久小视频 | 国产区在线观看 | 性色视频在线观看 | 视频一区二区三区中文字幕 | 精品一区二区三区四区五区 | 爱操影视 | 欧美日韩精品久久久免费观看 | 亚洲一区二区三区视频 | 日韩免费视频一区二区 | 国产精品成人一区二区 |