我可以使用另一个解决方案来解决这个问题吗?
我建议您使用基本标记并重构该功能,以便与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);