1

这不起作用:

directionsDisplay.setDirections(response.routes[1]);

这有效:

directionsDisplay.setDirections(response);

你能解释一下这个原因吗?

4

1 回答 1

0

您需要设置路线索引。要显示第二条路线,请使用:

var route_num = 1;
var first_load = false;
directionsDisplay.setRouteIndex(route_num);
if (first_load) {
    // only execute this when the directions are first displayed
    directionsDisplay.setDirections(objRoutesResponse);
}
于 2013-07-16T16:02:02.967 回答