久久久久久久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人片在线观看无码 | 国产精品国产a级 | 91社区在线高清 | 欧美成人a∨高清免费观看 老司机午夜性大片 | 欧美成人手机在线 | 日韩精品一区二区三区在线播放 | 日本一区二区在线视频 | 欧美 日韩 国产 在线 | 黄色日本视频 | 午夜极品| 亚洲乱码一区二区三区在线观看 | 日韩欧美在线播放 | 欧美淫片| 国产激情视频 | 久久久资源 | 久久51 | 天堂网中文字幕在线观看 | 国产精品视频中文字幕 | 午夜av电影院 | 国产午夜在线观看 | 国产成人午夜精品影院游乐网 | 宅男噜噜噜66一区二区 | 国产成人精品一区二区在线 | 久久99蜜桃综合影院免费观看 | 日韩中文字幕一区 | a在线观看 | 亚洲精品免费视频 | 在线免费观看成人 | 国产精品久久久亚洲 | 羞羞视频网站在线观看 | 精品videossex高潮汇编 | 99久久99| 午夜影院视频在线观看 | 久久久妇女国产精品影视 | 久久国产精品-国产精品 | 在线视频中文字幕 | 在线视频91 | 日日日色 | 精品国产成人 |