示例代码如下: getDriverRoute() { myAmapFun.getDrivingRoute({ origin: `${this.startPoint.longitude},${this.startPoint.latitude}`, destination: `${this.endPoint.longitude},${this.endPoint.latitude}`, strategy: 5, success: (res) => { const points = []; const { steps } = res.paths[0]; for (let item of steps) { item.polyline = item.polyline.split(";"); for (let line of item.polyline) { points.push({ longitude: line.split(",")[0], latitude: line.split(",")[1], }); } } this.polyline = [ { points: points, color: "#12c983", width: 8, arrowLine: false, }, ]; }, }); }