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. 主站蜘蛛池模板: 建筑消防设施检测系统检测箱-电梯**检测仪器箱-北京宇成伟业科技有限责任公司 | 渣土车电机,太阳能跟踪器电机,蜗轮蜗杆减速电机厂家-淄博传强电机 | 底部填充胶_电子封装胶_芯片封装胶_芯片底部填充胶厂家-东莞汉思新材料 | 东莞注册公司-代办营业执照-东莞公司注册代理记账-极刻财税 | Win10系统下载_32位/64位系统/专业版/纯净版下载 | 北京企业宣传片拍摄_公司宣传片制作-广告短视频制作_北京宣传片拍摄公司 | 工业机械三维动画制作 环保设备原理三维演示动画 自动化装配产线三维动画制作公司-南京燃动数字 聚合氯化铝_喷雾聚氯化铝_聚合氯化铝铁厂家_郑州亿升化工有限公司 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 高压无油空压机_无油水润滑空压机_水润滑无油螺杆空压机_无油空压机厂家-科普柯超滤(广东)节能科技有限公司 | SEO网站优化,关键词排名优化,苏州网站推广-江苏森歌网络 | 合肥抖音SEO网站优化-网站建设-网络推广营销公司-百度爱采购-安徽企匠科技 | 中视电广_短视频拍摄_短视频推广_短视频代运营_宣传片拍摄_影视广告制作_中视电广 | 洗石机-移动滚筒式,振动,螺旋,洗矿机-青州冠诚重工机械有限公司 | 塑料造粒机「厂家直销」-莱州鑫瑞迪机械有限公司 | 无痕胶_可移胶_无痕双面胶带_可移无痕胶厂家-东莞凯峰 | 闭端端子|弹簧螺式接线头|防水接线头|插线式接线头|端子台|电源线扣+护线套|印刷电路板型端子台|金笔电子代理商-上海拓胜电气有限公司 | 焊管生产线_焊管机组_轧辊模具_焊管设备_焊管设备厂家_石家庄翔昱机械 | 成人纸尿裤,成人尿不湿,成人护理垫-山东康舜日用品有限公司 | 北京租车牌|京牌指标租赁|小客车指标出租 | 工业用品一站式采购平台|南创工品汇-官网|广州南创 | C形臂_动态平板DR_动态平板胃肠机生产厂家制造商-普爱医疗 | 对照品_中药对照品_标准品_对照药材_「格利普」高纯中药标准品厂家-成都格利普生物科技有限公司 澳门精准正版免费大全,2025新澳门全年免费,新澳天天开奖免费资料大全最新,新澳2025今晚开奖资料,新澳马今天最快最新图库 | 台湾阳明固态继电器-奥托尼克斯光电传感器-接近开关-温控器-光纤传感器-编码器一级代理商江苏用之宜电气 | 河南橡胶接头厂家,河南波纹补偿器厂家,河南可曲挠橡胶软连接,河南套筒补偿器厂家-河南正大阀门 | 档案密集架,移动密集架,手摇式密集架,吉林档案密集架-厂家直销★价格公道★质量保证 | 固诺家居-全屋定制十大品牌_整体衣柜木门橱柜招商加盟 | 精密模具制造,注塑加工,吹塑和吹瓶加工,EPS泡沫包装生产 - 济南兴田塑胶有限公司 | 旋振筛|圆形摇摆筛|直线振动筛|滚筒筛|压榨机|河南天众机械设备有限公司 | 温湿度记录纸_圆盘_横河记录纸|霍尼韦尔记录仪-广州汤米斯机电设备有限公司 | MES系统-WMS系统-MES定制开发-制造执行MES解决方案-罗浮云计算 | 医院专用门厂家报价-医用病房门尺寸大全-抗菌木门品牌推荐 | 千斤顶,液压千斤顶-力良企业,专业的液压千斤顶制造商,shliliang.com | 安全阀_弹簧式安全阀_美标安全阀_工业冷冻安全阀厂家-中国·阿司米阀门有限公司 | 扬尘在线监测系统_工地噪声扬尘检测仪_扬尘监测系统_贝塔射线扬尘监测设备「风途物联网科技」 | 仓储笼_仓储货架_南京货架_仓储货架厂家_南京货架价格低-南京一品仓储设备制造公司 | 百度爱采购运营研究社社群-店铺托管-爱采购代运营-良言多米网络公司 | 对夹式止回阀_对夹式蝶形止回阀_对夹式软密封止回阀_超薄型止回阀_不锈钢底阀-温州上炬阀门科技有限公司 | 合金ICP光谱仪(磁性材料,工业废水)-百科 | 温州中研白癜风专科_温州治疗白癜风_温州治疗白癜风医院哪家好_温州哪里治疗白癜风 | 捷码低代码平台 - 3D数字孪生_大数据可视化开发平台「免费体验」 | 管理会计网-PCMA初级管理会计,中级管理会计考试网站 |