vue使用高德地图地图开发,使用的cdn引入方法,怎么使用步行路径规划api?-灵析社区

一颗西兰花

修改后 draw_way() { let location_point = [ { start: [117.066993, 36.63845], end: [117.063498, 36.638153] } ]; // 注册步行规划插件 AMap.plugin("AMap.Walking", () => { location_point.forEach((item, index) => { let startPoint = location_point[index].start; let endPoint = location_point[index].end; this.walking = new AMap.Walking({ map: this.map, panel: "panel" + index }); this.walking.search(startPoint, endPoint, (status, result) => { if (status === "complete") { let routes = result.routes; let point_path = routes[0].steps; point_path.forEach((item, index) => { let polyline = new AMap.Polyline({ map: this.map, path: point_path[index].path, strokeColor: "red", strokeOpacity: 0.7, strokeWeight: 4 }); }); } else { console.error(result); } }); }); }); }, 实现效果 ![image.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/images/20250103/f2071c0fe21dc0f64bb12937479185e2.png)

阅读量:209

点赞量:5

问AI
看文档 "https://lbs.amap.com/api/webservice/guide/api/direction" (https://link.segmentfault.com/?enc=CaJ9OF3OZRznVIo0gI%2BXSQ%3D%3D.Kntgz3kI%2BFtt6s7AMzXN4phw6Jd%2FUkBnunuJgFPIllUi1YfsJ4oxjKLbtv6p5JDEC8UB2%2FloldspMNO83%2BEi0w%3D%3D) "https://lbs.amap.com/api/webservice/guide/api/newroute" (https://link.segmentfault.com/?enc=%2B9e1ynGclIbbF8uN%2Bf%2B5GQ%3D%3D.F7%2B54tKc2dV99%2FDrhAQmJTMQjEilzsZrIVg%2BJP9btBkMIGTyGZ42yHQjU%2BhbUi4JHnZ8QQ%2FCPn4kv7BkiSyMeQ%3D%3D)