如何在小叶路由机上添加标记机

问题描述 投票:0回答:1
但是我得到了错误: 对象文字只能指定已知属性,并且“ createMarker”类型中不存在'rutingControloptions'.ts(2353)

我可以使用另一个解决方案来解决这个问题吗?
    

我建议您使用基本标记并重构该功能,以便与L.Marker实例化:

this.routingControl = L.Routing.control({ waypoints: [ L.latLng(pickup.location.latitude, pickup.location.longitude), L.latLng(dropOff.location.latitude, dropOff.location.longitude), ], routeWhileDragging: true, createMarker: (i: number, waypoint: L.Routing.Waypoint, n: number) => { return L.marker(waypoint.latLng, { icon: this.createIcon(i.toString()), // Custom icon if needed }); } }).addTo(this.mapAdmin);
angular typescript leaflet leaflet-routing-machine
1个回答
0
投票
您可以检查此文档以防止任何语法错误:

Https://leafletjs.com/reference.html#marker

    

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.