javascript - 无法读取传单中折线箭头的代码中出现未定义错误的属性“箭头头”
问题描述
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);
解决方案
在您的 html 文件中,您是否导入了 polylinedecorator 脚本,
<script src="../dist/leaflet.polylineDecorator.js"></script>
听起来很愚蠢,但我多次为这个错误挠头。
推荐阅读
- r - 使用 glm 预测新数据
- r - 将一个情节小提琴情节分成两组以上
- python - 我应该在哪里将 db/redis 连接绑定到 scrapy?
- javascript - 移除目标节点时移除事件监听器?
- jenkins - Groovy 逐行读取文件并将其存储到列表中
- python - 将 sagemaker 中的 pandas 数据帧写入 AWS S3 文件
- android - androidTest 未在 Android API 低于 21 的模拟器上运行
- xml - 使用带有文本文件的 awk 命令创建 XML
- php - 如何根据选中的复选框提交多个数组?
- javascript - 仅显示该日期的信息