无法读取传单中折线箭头的代码中发生未定义错误的属性“ arrowHead”

时间:2019-01-10 06:23:06

标签: javascript asp.net leaflet

var somePoints = [];

for (var rowIndex in rows) {

    somePoints.push(L.latLng(rows[rowIndex].Lat, rows[rowIndex].Lon));
}

var pl = L.polyline(somePoints);

pl.addTo(map);

var decorator = L.polylineDecorator(pl, {
    patterns: [
        {offset: 0, repeat: 50, symbol: L.Symbol.arrowHead({pixelSize: 8, polygon: false, pathOptions: {stroke: true}})}
    ]
}).addTo(map);

1 个答案:

答案 0 :(得分:0)

您在html文件中导入了polylinedecorator脚本,

<script src="../dist/leaflet.polylineDecorator.js"></script>

在这里? https://github.com/bbecquet/Leaflet.PolylineDecorator/blob/96858e837a07c08e08dbba1c6751abdec9a85433/example/example.html#L17

听起来很愚蠢,但由于这个错误我多次挠头。