pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

    <legend id='m2zB4'><style id='m2zB4'><dir id='m2zB4'><q id='m2zB4'></q></dir></style></legend>
    1. <small id='m2zB4'></small><noframes id='m2zB4'>

      <i id='m2zB4'><tr id='m2zB4'><dt id='m2zB4'><q id='m2zB4'><span id='m2zB4'><b id='m2zB4'><form id='m2zB4'><ins id='m2zB4'></ins><ul id='m2zB4'></ul><sub id='m2zB4'></sub></form><legend id='m2zB4'></legend><bdo id='m2zB4'><pre id='m2zB4'><center id='m2zB4'></center></pre></bdo></b><th id='m2zB4'></th></span></q></dt></tr></i><div class="3vbokey" id='m2zB4'><tfoot id='m2zB4'></tfoot><dl id='m2zB4'><fieldset id='m2zB4'></fieldset></dl></div>
    2. <tfoot id='m2zB4'></tfoot>

      反應傳單地圖未正確顯示

      react-leaflet map not correctly displayed(反應傳單地圖未正確顯示)

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

          <tbody id='dWnH1'></tbody>
        • <legend id='dWnH1'><style id='dWnH1'><dir id='dWnH1'><q id='dWnH1'></q></dir></style></legend>

              <bdo id='dWnH1'></bdo><ul id='dWnH1'></ul>
              <tfoot id='dWnH1'></tfoot>

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

              1. 本文介紹了反應傳單地圖未正確顯示的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                我正在嘗試使用 react-leaflet 來顯示地圖.我使用

                這是我的代碼:

                DeviceMap.js

                從'react'導入反應從'react-leaflet'導入{地圖,標記,彈出窗口,TileLayer};導出類 DeviceMap 擴展 React.Component {構(gòu)造函數(shù)(){極好的();這個.state = {緯度:51.505,液化天然氣:-0.09,縮放:13,};}使成為() {常量位置 = [this.state.lat, this.state.lng];返回 (<地圖中心={position} zoom={this.state.zoom} scrollWheelZoom={false}>

                DeviceTabs.js

                導出類 DeviceTabs 擴展 React.Component {狀態(tài) = {指數(shù):0};handleTabChange = (索引) =>{this.setState({ index })};使成為 () {返回 (<標簽索引={this.state.index} onChange={this.handleTabChange}><標簽標簽='值'><DeviceTable {...this.props}/></標簽><標簽標簽='地圖'><div className={style.leaflet}><設備映射/></div></標簽></標簽>)}}

                style.scss

                .leaflet {高度:300px;寬度:100%;}

                控制臺中沒有錯誤,我不知道在哪里搜索.由于小提琴正在工作,因此它不是錯誤.我錯過了什么嗎?

                解決方案

                看起來你還沒有加載 Leaflet 樣式表.

                來自 react-leaflet GitHub 指南:

                <塊引用>

                如果您不熟悉 Leaflet,請確保在使用此庫之前閱讀其快速入門指南.您尤其需要將其 CSS 添加到您的頁面以正確呈現(xiàn)地圖,并設置容器的高度.

                http://leafletjs.com/examples/quick-start/

                這是你需要的:

                更新

                注意 @ThomasThiebaud 表示您可能還需要設置 .leaflet-container

                的高度

                --

                Ange Loron 還提供了一個正確的、可選的 JS 模塊導入(相對于 cdn 或樣式鏈接)

                導入'leaflet/dist/leaflet.css';



                對于它的價值,文檔頁面設計不佳...維護者在 GitHub 中不斷處理這個問題,但由于某種原因,這個問題是*錯誤的用戶不斷不進行所需的設置./s

                I'm trying to use react-leaflet to display a map. I use the code from this fiddle which is working, but on my computer I have this output

                Here is my code :

                DeviceMap.js

                import React from 'react'
                import { Map, Marker, Popup, TileLayer } from 'react-leaflet';
                
                export class DeviceMap extends React.Component {
                  constructor() {
                    super();
                    this.state = {
                      lat: 51.505,
                      lng: -0.09,
                      zoom: 13,
                    };
                  }
                
                  render() {
                    const position = [this.state.lat, this.state.lng];
                    return (
                      <Map center={position} zoom={this.state.zoom} scrollWheelZoom={false}>
                        <TileLayer
                          attribution='&copy; <a >OpenStreetMap</a> contributors'
                          url='http://{s}.tile.osm.org/{z}/{x}/{y}.png'
                        />
                        <Marker position={position}>
                          <Popup>
                            <span>A pretty CSS3 popup. <br/> Easily customizable.</span>
                          </Popup>
                        </Marker>
                      </Map>
                    );
                  }
                }
                
                export default DeviceMap
                

                DeviceTabs.js

                export class DeviceTabs extends React.Component {
                  state = {
                    index: 0
                  };
                
                  handleTabChange = (index) => {
                    this.setState({ index })
                  };
                
                  render () {
                    return (
                      <Tabs index={this.state.index} onChange={this.handleTabChange}>
                        <Tab label='Values'>
                          <DeviceTable {...this.props} />
                        </Tab>
                        <Tab label='Map'>
                          <div className={style.leaflet}>
                            <DeviceMap />
                          </div>
                        </Tab>
                      </Tabs>
                    )
                  }
                }
                

                style.scss

                .leaflet {
                  height: 300px;
                  width: 100%;
                }
                

                There is no error in the console, and I have no more idea where to search. Since the fiddle is working it is not a bug. Did I miss something ?

                解決方案

                Looks like you haven't loaded in the Leaflet stylesheet.

                From the react-leaflet GitHub guide:

                If you are not familiar with Leaflet, make sure you read its quick start guide before using this library. You will notably need to add its CSS to your page to render the map properly, and set the height of the container.

                http://leafletjs.com/examples/quick-start/

                Here is what you'll need:

                <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.1/dist/leaflet.css" />
                

                Update

                Note @ThomasThiebaud indicates you may also have to set up the height of .leaflet-container

                --

                Ange Loron also gave a correct, optional, JS module import (vs cdn or style link)

                import 'leaflet/dist/leaflet.css';



                For what its worth, the documentation page is poorly designed... and the maintainer continuously deals with this issue in GitHub, but for some reason, the issue is the *fault of the users who continuously don't do the required setup. /s

                這篇關于反應傳單地圖未正確顯示的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                相關文檔推薦

                Check if a polygon point is inside another in leaflet(檢查一個多邊形點是否在傳單中的另一個內(nèi)部)
                Changing leaflet markercluster icon color, inheriting the rest of the default CSS properties(更改傳單標記群集圖標顏色,繼承其余默認 CSS 屬性)
                Trigger click on leaflet marker(觸發(fā)點擊傳單標記)
                How can I change the default loading tile color in LeafletJS?(如何更改 LeafletJS 中的默認加載磁貼顏色?)
                Adding Leaflet layer control to sidebar(將 Leaflet 圖層控件添加到側(cè)邊欄)
                Leaflet - get latitude and longitude of a marker inside a pop-up(Leaflet - 在彈出窗口中獲取標記的緯度和經(jīng)度)

                    <tbody id='2P9Mo'></tbody>
                  • <tfoot id='2P9Mo'></tfoot><legend id='2P9Mo'><style id='2P9Mo'><dir id='2P9Mo'><q id='2P9Mo'></q></dir></style></legend>

                    <small id='2P9Mo'></small><noframes id='2P9Mo'>

                      <bdo id='2P9Mo'></bdo><ul id='2P9Mo'></ul>
                        <i id='2P9Mo'><tr id='2P9Mo'><dt id='2P9Mo'><q id='2P9Mo'><span id='2P9Mo'><b id='2P9Mo'><form id='2P9Mo'><ins id='2P9Mo'></ins><ul id='2P9Mo'></ul><sub id='2P9Mo'></sub></form><legend id='2P9Mo'></legend><bdo id='2P9Mo'><pre id='2P9Mo'><center id='2P9Mo'></center></pre></bdo></b><th id='2P9Mo'></th></span></q></dt></tr></i><div class="q2earw3" id='2P9Mo'><tfoot id='2P9Mo'></tfoot><dl id='2P9Mo'><fieldset id='2P9Mo'></fieldset></dl></div>
                        1. 主站蜘蛛池模板: 无机纤维喷涂棉-喷涂棉施工工程-山东华泉建筑工程有限公司▲ | 消防泵-XBD单级卧式/立式消防泵-上海塑泉泵阀(集团)有限公司 | 上海璟文空运首页_一级航空货运代理公司_机场快递当日达 | 缠绕机|缠绕膜包装机|缠绕包装机-上海晏陵智能设备有限公司 | 螺旋压榨机-刮泥机-潜水搅拌机-电动泥斗-潜水推流器-南京格林兰环保设备有限公司 | 爱佩恒温恒湿测试箱|高低温实验箱|高低温冲击试验箱|冷热冲击试验箱-您身边的模拟环境试验设备技术专家-合作热线:400-6727-800-广东爱佩试验设备有限公司 | 集装箱展厅-住人集装箱住宿|建筑|房屋|集装箱售楼处-山东锐嘉科技工程有限公司 | 工业CT-无锡璟能智能仪器有限公司| 深圳公司注册-工商注册代理-注册公司流程和费用_护航财税 | 缓蚀除垢剂_循环水阻垢剂_反渗透锅炉阻垢剂_有机硫化物-郑州威大水处理材料有限公司 | 天津货架厂_穿梭车货架_重型仓储货架_阁楼货架定制-天津钢力仓储货架生产厂家_天津钢力智能仓储装备 | 东莞喷砂机-喷砂机-喷砂机配件-喷砂器材-喷砂加工-东莞市协帆喷砂机械设备有限公司 | 盘式曝气器-微孔曝气器-管式曝气器-曝气盘-斜管填料 | 郑州市前程水处理有限公司 | 兰州UPS电源,兰州山特UPS-兰州万胜商贸 | 水平垂直燃烧试验仪-灼热丝试验仪-漏电起痕试验仪-针焰试验仪-塑料材料燃烧检测设备-IP防水试验机 | 小程序开发公司_APP开发多少钱_软件开发定制_微信小程序制作_客户销售管理软件-济南小溪畅流网络科技有限公司 | 仓储笼_仓储货架_南京货架_仓储货架厂家_南京货架价格低-南京一品仓储设备制造公司 | 呼末二氧化碳|ETCO2模块采样管_气体干燥管_气体过滤器-湖南纳雄医疗器械有限公司 | 巨野月嫂-家政公司-巨野县红墙安康母婴护理中心 | 预制舱-电力集装箱预制舱-模块化预制舱生产厂家-腾达电器设备 | Eiafans.com_环评爱好者 环评网|环评论坛|环评报告公示网|竣工环保验收公示网|环保验收报告公示网|环保自主验收公示|环评公示网|环保公示网|注册环评工程师|环境影响评价|环评师|规划环评|环评报告|环评考试网|环评论坛 - Powered by Discuz! | 团建-拓展-拓展培训-拓展训练-户外拓展训练基地[无锡劲途] | TYPE-C厂家|TYPE-C接口|TYPE-C防水母座|TYPE-C贴片-深圳步步精 | 医养体检包_公卫随访箱_慢病随访包_家签随访包_随访一体机-济南易享医疗科技有限公司 | 泰兴市热钻机械有限公司-热熔钻孔机-数控热熔钻-热熔钻孔攻牙一体机 | 专业音响设备_舞台音响设备_会议音响工程-首选深圳一禾科技 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | 电脑知识|软件|系统|数据库|服务器|编程开发|网络运营|知识问答|技术教程文章 - 好吧啦网 | 安平县鑫川金属丝网制品有限公司,防风抑尘网,单峰防风抑尘,不锈钢防风抑尘网,铝板防风抑尘网,镀铝锌防风抑尘网 | 儿童乐园|游乐场|淘气堡招商加盟|室内儿童游乐园配套设备|生产厂家|开心哈乐儿童乐园 | 流程管理|流程管理软件|企业流程管理|微宏科技-AlphaFlow_流程管理系统软件服务商 | 德州万泰装饰 - 万泰装饰装修设计软装家居馆 | 电子巡更系统-巡检管理系统-智能巡检【金万码】 | 泰国试管婴儿_泰国第三代试管婴儿_泰国试管婴儿费用/多少钱_孕泰来 | 单锥双螺旋混合机_双螺旋锥形混合机-无锡新洋设备科技有限公司 | led冷热冲击试验箱_LED高低温冲击试验箱_老化试验箱-爱佩百科 | 郑州墨香品牌设计公司|品牌全案VI设计公司 | 湖南自考_湖南自学考试网| 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 上海深蓝_缠绕机_缠膜机-上海深蓝机械装备有限公司 | 长沙发电机-湖南发电机-柴油发电机供应厂家-长沙明邦智能科技 |