Javascript 使用传单传送机更改传单的颜色

Javascript 使用传单传送机更改传单的颜色,javascript,angularjs,ecmascript-6,leaflet,Javascript,Angularjs,Ecmascript 6,Leaflet,如何使用传单传送机器库将传单的颜色从红色更改为其他颜色?我必须用L.Routing.Line更改样式选项,但我不知道如何更改 从“传单”导入L; 类控制器{ /*@ngInject*/ 构造函数($http){ this.name='carte'; 这个。$http=$http; this.map=L.map('map'); L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}{r}.png'{ 属性:“©OpenStreetMap贡献者” }).ad

如何使用传单传送机器库将传单的颜色从红色更改为其他颜色?我必须用L.Routing.Line更改样式选项,但我不知道如何更改

从“传单”导入L;
类控制器{
/*@ngInject*/
构造函数($http){
this.name='carte';
这个。$http=$http;
this.map=L.map('map');
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}{r}.png'{
属性:“©OpenStreetMap贡献者”
}).addTo(此.map);
const control=L.Routing.control({
航路点:[
L.latLng(45.750000,4.850000),
L.latLng(45.188529,5.724523999974),
L.latLng(45.00,5.74)
],
拉格朗日之旅:没错,
地理编码器:L.Control.geocoder.photon()
});
control.addTo(this.map);
control.on('waypointschanged',()=>{
console.log(control.\u路由[0].summary.totalDistance);
this.distance=`${Math.round(control._routes[0].summary.totalDistance/1000)}km`;
this.temps=this.secondsToHm(控制._路由[0].summary.totalTime);
});
新L.路线图({
geocoderPlaceholder:(i,数字小数点)=>{
返回i==0?
“Départ”:
(i0?h+“h”+(m<10?“0”:“):”)+m+“min”);//eslint禁用行
}
}
导出默认控制器;
根据文件:

 L.Routing.line(yourRoute, {
   styles:[{color: 'black', opacity: 0.15, weight: 9}, {color: 'white', opacity: 0.8, weight: 6}, {color: 'green', opacity: 1, weight: 2}]
});
资料来源:

您也可以在控件中尝试:

L.Routing.control({
   waypoints: waypoints,
   lineOptions: {
      styles: [{color: 'white', opacity: 1, weight: 5}]
   }
}).addTo(this.map)
来源:

根据文件:

 L.Routing.line(yourRoute, {
   styles:[{color: 'black', opacity: 0.15, weight: 9}, {color: 'white', opacity: 0.8, weight: 6}, {color: 'green', opacity: 1, weight: 2}]
});
资料来源:

您也可以在控件中尝试:

L.Routing.control({
   waypoints: waypoints,
   lineOptions: {
      styles: [{color: 'white', opacity: 1, weight: 5}]
   }
}).addTo(this.map)
资料来源: