Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs Ionic react应用程序无法识别传单插件_Reactjs_Ionic Framework_Npm_Leaflet_Cdn - Fatal编程技术网

Reactjs Ionic react应用程序无法识别传单插件

Reactjs Ionic react应用程序无法识别传单插件,reactjs,ionic-framework,npm,leaflet,cdn,Reactjs,Ionic Framework,Npm,Leaflet,Cdn,我面临以下问题: 我想在我的Ionic React应用程序中包含一个传单插件(AwesomeMarkers)。在插件的自述之后,我必须在传单库之后包括FontAwesome、插件JS文件和插件CSS文件 我确实将其包含在index.html中,它看起来如下所示: <!-- LEAFLET --> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/le

我面临以下问题:

我想在我的Ionic React应用程序中包含一个传单插件(AwesomeMarkers)。在插件的自述之后,我必须在传单库之后包括FontAwesome、插件JS文件和插件CSS文件

我确实将其包含在index.html中,它看起来如下所示:

    <!-- LEAFLET -->
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
   integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
   crossorigin=""/>

    <!-- Make sure you put this AFTER Leaflet's CSS -->
    <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
   integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
   crossorigin=""></script>

   <!-- LEAFLET AWESOME MARKERS -->
    <script src="https://kit.fontawesome.com/d2ca6e6d71.js" crossorigin="anonymous"></script>

    <link rel="stylesheet" href="assets/css/leaflet.awesome-markers.css">

    <script src="assets/leaflet.awesome-markers.min.js"></script>
import 'leaflet.awesome-markers';
但是window.L对象没有AwesomeMarkers函数

AwesomeMarkers.js文件和AwesomeMarkers.css在“我的网络分析”视图中加载状态304

我还通过npm安装了传单和插件,但并没有解决我的问题

有人能告诉我为什么我不能使用这个插件吗


提前感谢

将模块保存为@types:

npm install --save @types/leaflet.awesome-markers
然后像这样导入它:

    <!-- LEAFLET -->
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
   integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
   crossorigin=""/>

    <!-- Make sure you put this AFTER Leaflet's CSS -->
    <script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
   integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
   crossorigin=""></script>

   <!-- LEAFLET AWESOME MARKERS -->
    <script src="https://kit.fontawesome.com/d2ca6e6d71.js" crossorigin="anonymous"></script>

    <link rel="stylesheet" href="assets/css/leaflet.awesome-markers.css">

    <script src="assets/leaflet.awesome-markers.min.js"></script>
import 'leaflet.awesome-markers';