1、如何两个标签运动时同时显示两个标签信息
在leaflet/src/map/leaflet.js中改变两个布朗值autoPan和autoClass,其中!0是true,!1是false,更改为autoPan:false(!1) autoClose:true(!0)
2、如何更改线条的样式,包括加箭头 颜色等
使用leaflet-polylinedecorator,在GitHub上有该插件的详细描述,安装以后有一个example.js文件,里面也有使用方法的例子
newDecorator(lineArray) {
const map = this.GLOBAL.map;
return L.polylineDecorator(lineArray, {
patterns: [
{
offset: 25,
repeat: 100,
symbol: L.Symbol.arrowHead({pixelSize: 10, pathOptions: {fillOpacity: 1, weight: 0, color: 'red'}})
}
]
}).addTo(map);
}
效果: