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

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

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

      3. <legend id='bGoMv'><style id='bGoMv'><dir id='bGoMv'><q id='bGoMv'></q></dir></style></legend>

        在 Leaflet 彈出窗口中添加按鈕

        Adding buttons inside Leaflet popup(在 Leaflet 彈出窗口中添加按鈕)
          <tfoot id='WZoX6'></tfoot>

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

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

              <tbody id='WZoX6'></tbody>
              <bdo id='WZoX6'></bdo><ul id='WZoX6'></ul>

                  <legend id='WZoX6'><style id='WZoX6'><dir id='WZoX6'><q id='WZoX6'></q></dir></style></legend>

                  本文介紹了在 Leaflet 彈出窗口中添加按鈕的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  當我嘗試在 Leaflet 彈出窗口中添加按鈕時遇到問題.單擊地圖時會生成彈出窗口.

                  I got a problem when I try to add buttons inside a Leaflet popup. The popup is generated when you click on the map.

                  理想情況下,我想彈出 2 個按鈕:

                  Ideally I want to popuo to show 2 buttons:

                  • 從這里開始
                  • 然后去這個位置

                  這個草圖是我想要的結果的一個例子:

                  This sketch is an example of the result I want:

                   ________________________________________________
                  |You clicked the map at LatLng(XXXXX,XXXXX)      |
                  |  ---------------    -------------------        |
                  | |Start from here|  |Go to this location|       |
                  |  ---------------    -------------------        |
                  |___________________  ___________________________|
                                     /
                  

                  這是我在彈出窗口中看到的內容:您在 LatLng(XXXXX,XXXX) [object HTMLButtonElement] 處單擊了地圖

                  this is what I get inside my popUp : You clicked the map at LatLng(XXXXX,XXXX) [object HTMLButtonElement]

                  我正在嘗試使用 L.domUtil 創建按鈕

                  I am trying to create the buttons using L.domUtil

                  defineYourWaypointOnClick(e: any) {
                  
                  var choicePopUp = L.popup();
                  var container = L.DomUtil.create('div'),
                    startBtn = this.createButton('Start from this location', container),
                    destBtn = this.createButton('Go to this location', container);
                  
                  choicePopUp
                    .setLatLng(e.latlng)
                    .setContent('You clicked the map at ' + e.latlng.toString() + '<br>' + startBtn)
                    .openOn(this.map);
                  
                  L.DomEvent.on(startBtn, 'click', () => {
                    alert("toto");
                  });
                  
                  L.DomEvent.on(destBtn, 'click', () => {
                    alert("tata");
                  });
                  }
                  
                  createButton(label: string, container: any) {
                      var btn = L.DomUtil.create('button', '', container);
                      btn.setAttribute('type', 'button');
                      btn.innerHTML = label;
                      return btn;
                  }
                  

                  我從這里調用我的方法:

                  I call my method from here :

                  this.map.on('click', (e: any) => {
                    this.defineYourWaypointOnClick(e);
                  });
                  

                  提前感謝您能給我的任何幫助:)

                  Thank you in advance for any help you can give me :)

                  推薦答案

                  您應該使用 innerHTML 向您的傳單添加按鈕,如下所示

                  You should be using innerHTML to add buttons to your leaflet as below

                  defineYourWaypointOnClick(e: any) {
                  
                  var choicePopUp = L.popup();
                  var container = L.DomUtil.create('div');
                  //////////////////////////////////////////////////////////////////////////////////////////////
                  ///////////modified here
                  startBtn = this.createButton('Start from this location', container),
                  destBtn = this.createButton('Go to this location', container);
                  div.innerHTML = ''+startBtn+ '&nbsp;&nbsp;&nbsp;&nbsp;' + destBtn ; 
                  //////////////////////////////////////////////////////////////////////////////////////////////
                  
                  choicePopUp
                    .setLatLng(e.latlng)
                    .setContent('You clicked the map at ' + e.latlng.toString() + '<br>' + startBtn)
                    .openOn(this.map);
                  
                  L.DomEvent.on(startBtn, 'click', () => {
                    alert("toto");
                  });
                  
                  L.DomEvent.on(destBtn, 'click', () => {
                    alert("tata");
                  });
                  }
                  
                  createButton(label: string, container: any) {
                  var btn = L.DomUtil.create('button', '', container);
                  btn.setAttribute('type', 'button');
                  btn.innerHTML = label;
                  return btn;
                  }
                  

                  這篇關于在 Leaflet 彈出窗口中添加按鈕的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

                  相關文檔推薦

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

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

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

                        <tbody id='vWHcd'></tbody>

                          <bdo id='vWHcd'></bdo><ul id='vWHcd'></ul>
                          <tfoot id='vWHcd'></tfoot>
                          <legend id='vWHcd'><style id='vWHcd'><dir id='vWHcd'><q id='vWHcd'></q></dir></style></legend>
                          1. 主站蜘蛛池模板: 深圳宣传片制作-企业宣传视频制作-产品视频拍摄-产品动画制作-短视频拍摄制作公司 | 硫化罐_蒸汽硫化罐_大型硫化罐-山东鑫泰鑫智能装备有限公司 | 【电子厂招聘_普工招工网_工厂招聘信息平台】-工立方打工网 | 免费B2B信息推广发布平台 - 推发网| 干培两用箱-细菌恒温培养箱-菲斯福仪器 | 影合社-影视人的内容合作平台 | 悬浮拼装地板_幼儿园_篮球场_悬浮拼接地板-山东悬浮拼装地板厂家 | 液压中心架,数控中心架,自定心中心架-烟台恒阳机电设计有限公司 行星搅拌机,双行星搅拌机,动力混合机,无锡米克斯行星搅拌机生产厂家 | 济南玻璃安装_济南玻璃门_济南感应门_济南玻璃隔断_济南玻璃门维修_济南镜片安装_济南肯德基门_济南高隔间-济南凯轩鹏宇玻璃有限公司 | 示波器高压差分探头-国产电流探头厂家-南京桑润斯电子科技有限公司 | 次氯酸钠厂家,涉水级次氯酸钠,三氯化铁生产厂家-淄博吉灿化工 | 不锈钢拉手厂家|浴室门拉手厂家|江门市蓬江区金志翔五金制品有限公司 | 石膏基自流平砂浆厂家-高强石膏基保温隔声自流平-轻质抹灰石膏粉砂浆批发-永康市汇利建设有限公司 | 江西高职单独招生-江西单招考试-江西高职单招网 | 淄博不锈钢无缝管,淄博不锈钢管-鑫门物资有限公司 | 浙江宝泉阀门有限公司 | 印刷人才网 印刷、包装、造纸,中国80%的印刷企业人才招聘选印刷人才网! | 广州展台特装搭建商|特装展位设计搭建|展会特装搭建|特装展台制作设计|展览特装公司 | 科昊仪器超纯水机系统-可成气相液氮罐-美菱超低温冰箱-西安昊兴生物科技有限公司 | 上海网站建设-上海网站制作-上海网站设计-上海做网站公司-咏熠软件 | 金联宇电缆|广东金联宇电缆厂家_广东金联宇电缆实业有限公司 | 皮带式输送机械|链板式输送机|不锈钢输送机|网带输送机械设备——青岛鸿儒机械有限公司 | 微水泥_硅藻泥_艺术涂料_艺术漆_艺术漆加盟-青岛泥之韵环保壁材 武汉EPS线条_EPS装饰线条_EPS构件_湖北博欧EPS线条厂家 | 实验室装修_实验室设计_实验室规划设计- 上海广建净化工程公司 | 船用烟火信号弹-CCS防汛救生圈-船用救生抛绳器(海威救生设备) | TMT观察网_独特视角观察TMT行业| 宏源科技-房地产售楼系统|线上开盘系统|售楼管理系统|线上开盘软件 | 拼装地板,悬浮地板厂家,悬浮式拼装运动地板-石家庄博超地板科技有限公司 | 成都思迪机电技术研究所-四川成都思迪编码器 | 专业甜品培训学校_广东糖水培训_奶茶培训_特色小吃培训_广州烘趣甜品培训机构 | 太空舱_民宿太空舱厂家_移动房屋太空舱价格-豪品建筑 | 电子万能试验机_液压拉力试验机_冲击疲劳试验机_材料试验机厂家-济南众标仪器设备有限公司 | 青岛侦探调查_青岛侦探事务所_青岛调查事务所_青岛婚外情取证-青岛狄仁杰国际侦探公司 | 蒸汽吸附分析仪-进口水分活度仪|康宝百科 | 365文案网_全网创意文案句子素材站 | 电动葫芦|手拉葫芦|环链电动葫芦|微型电动葫芦-北京市凌鹰起重机械有限公司 | 不锈钢螺丝 - 六角螺丝厂家 - 不锈钢紧固件 - 万千紧固件--紧固件一站式采购 | 通信天线厂家_室分八木天线_对数周期天线_天线加工厂_林创天线源头厂家 | 南京泽朗生物科技有限公司| 一体化污水处理设备-一体化净水设备-「山东梦之洁水处理」 | 酸度计_PH计_特斯拉计-西安云仪|