Javascript 使用传单.PolylineDecorator,我读到了属性';破折号';未定义的

Javascript 使用传单.PolylineDecorator,我读到了属性';破折号';未定义的,javascript,leaflet,Javascript,Leaflet,在Laravel 6/blade/jquery 3/传单应用程序中,我想添加方向图标 多段线 我用npm安装了它,在参考资料/js/app.js中我导入了传单: require('./bootstrap'); require('jquery'); window.Vue = require('vue'); export const bus = new Vue() import 'leaflet-polylinedecorator'; import 'leaflet-rotatedmarker

在Laravel 6/blade/jquery 3/传单应用程序中,我想添加方向图标 多段线 我用npm安装了它,在参考资料/js/app.js中我导入了传单:

require('./bootstrap');

require('jquery');

window.Vue = require('vue');
export const bus = new Vue()

import 'leaflet-polylinedecorator';
import 'leaflet-rotatedmarker';
但我犯了个错误

 Cannot read property 'dash' of undefined
尝试以刀片形式使用示例:

@section('scripts')

    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
          integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
          crossorigin=""/>
    <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
            integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
            crossorigin=""></script>


    <script>


            var polyline = new L.Polyline(polylinePoints, {
            });
            polyline.addTo(mymap);
             var decorator = L.polylineDecorator(polyline, {
                patterns: [
                    {offset: 0, repeat: 20, symbol: L.Symbol.dash({pixelSize: 10})}
                ]
            }).addTo(mymap);

            // zoom the map to the polyline
            mymap.fitBounds(polyline.getBounds());
但这并没有帮助我,我仍然有同样的错误

我是否必须以其他方式添加导入行,而不是在resources/js/app.js中。 但我不知道如何在bade文件中添加导入,因为我试图:

<script>
    import * as L from 'leaflet';
    import 'leaflet-polylinedecorator';
哪种方法有效


谢谢

请看修改后的DPL,看修改后的DPL
<script>
    import * as L from 'leaflet';
    import 'leaflet-polylinedecorator';
Uncaught SyntaxError: Cannot use import statement outside a module