|
drawRoute(route) {
if ( route && !this.routeDrawn) {
// var aMap = api.require('aMap');
console.log("绘制路线")
this.aMap.drawRoute({
id: 1, // 路线id
autoresizing: false, // 自动调整地图可视区域
index: 1, // 路线方案的索引
styles: {
walkLine: {
width: 3,
color: '#698B22',
lineDash: false,
strokeImg: ''
},
driveLine: { // 驾车路线样式
width:10,
color: '#0000EE',
lineDash: false,
strokeImg: ''
},
icons: {
start: '',
end: '',
bus: '',
car: '',
man: ''
}
}
});
this.routeDrawn = true; // 标记路线已绘制
} else {
console.error('无法绘制路线,地图或路线数据未准备好。');
}
},
|
-
调试结果
|