为了账号安全,请及时绑定邮箱和手机立即绑定

传单错误:this.callInitHooks 不是函数错误?

传单错误:this.callInitHooks 不是函数错误?

阿晨1998 2022-07-21 22:31:55
我正在使用传单 v1.5.1。Chrome的错误是:leaflet.js:5 Uncaught TypeError: this.callInitHooks is not a function at Object.i [as Marker] (leaflet.js:5) at map1Rose2.php:77以下是将在 Chrome 中重现该问题的最少代码。我没有看到该功能有问题。错误出现在 . 我已经用尽了力地刺激和戳了这个东西,有人有想法吗?<!DOCTYPE html><html><head>    <title>NCM Map of Station Locations</title>    <meta charset="utf-8" />    <meta name="viewport" content="width=device-width, initial-scale=1.0">    <link rel="shortcut icon" type="image/x-icon" href="images/favicon-32x32.png" >    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>     <!-- ******************************** Load LEAFLET from CDN *********************************** -->   <link rel="stylesheet" href="https://unpkg.com/leaflet@1.5.1/dist/leaflet.css"  integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="  crossorigin=""/>  <script src="https://unpkg.com/leaflet@1.5.1/dist/leaflet.js"  integrity="sha512-GffPMF3RvMeYyc1LWMHtK8EbPv0iNZ8/oTtHPx9/cc2ILxQ+u905qIwdpULaqDkyBKgOaB57QTMg7ztg8Jm2Og=="  crossorigin=""></script>     <!-- ********************************* End Load LEAFLET **************************************** -->     <!-- ******************************** Load ESRI LEAFLET from CDN ******************************* -->     <script src="https://unpkg.com/esri-leaflet@2.2.4/dist/esri-leaflet.js"    integrity="sha512-tyPum7h2h36X52O2gz+Pe8z/3l+Y9S1yEUscbVs5r5aEY5dFmP1WWRY/WLLElnFHa+k1JBQZSCDGwEAnm2IxAQ=="    crossorigin=""></script>    <style>    </style></head><body>
查看完整描述

1 回答

?
慕田峪4524236

TA贡献1875条经验 获得超5个赞

你必须打电话new L.Marker()或L.marker()


要修复您的第二个错误(在评论中),您必须首先定义您的 featureGroup,然后创建标记。


var fg = new L.featureGroup();


var WA0TJT = L.Marker(new L.LatLng(39.202911,-94.602887),{

        contextmenu: true,

        contextmenuWidth: 140,

        contextmenuItems: [{ text: 'Click here to add mileage circles', callback: circleKoords}],               

        icon: new L.NumberedDivIcon({number: '1' }),

        title:"marker_1" }).addTo(fg).bindPopup("1<br><b>ID: #0013</b><br>WA0TJT<br>Keith Kaiser<br>Platte  Co., MO Dist: A<br>39.202911, -94.602887<br>EM29QE").openPopup();

您也不会在地图上看到任何内容,因为您没有将要素组添加到地图中。你需要一个地图实例。


var map = L.map('map', {

...

});

fg.addTo(map);


查看完整回答
反对 回复 2022-07-21
  • 1 回答
  • 0 关注
  • 735 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号