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

我正在使用传单 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>


阿晨1998
浏览 736回答 1
1回答

慕田峪4524236

你必须打电话new L.Marker()或L.marker()要修复您的第二个错误(在评论中),您必须首先定义您的 featureGroup,然后创建标记。var fg = new L.featureGroup();var WA0TJT = L.Marker(new L.LatLng(39.202911,-94.602887),{&nbsp; &nbsp; &nbsp; &nbsp; contextmenu: true,&nbsp; &nbsp; &nbsp; &nbsp; contextmenuWidth: 140,&nbsp; &nbsp; &nbsp; &nbsp; contextmenuItems: [{ text: 'Click here to add mileage circles', callback: circleKoords}],&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; icon: new L.NumberedDivIcon({number: '1' }),&nbsp; &nbsp; &nbsp; &nbsp; title:"marker_1" }).addTo(fg).bindPopup("1<br><b>ID: #0013</b><br>WA0TJT<br>Keith Kaiser<br>Platte&nbsp; Co., MO Dist: A<br>39.202911, -94.602887<br>EM29QE").openPopup();您也不会在地图上看到任何内容,因为您没有将要素组添加到地图中。你需要一个地图实例。var map = L.map('map', {...});fg.addTo(map);
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript