【发布时间】:2017-01-14 10:04:01
【问题描述】:
我正在尝试使用 DirectionsManager 类的 Bing Maps v8。文档描述了一个 dragDropCompleted 事件,如下链接:
https://msdn.microsoft.com/pt-br/library/hh312802.aspx
我已经创建了一个基于 Bing Maps Interactive SDK 的示例:
http://www.bing.com/api/maps/sdk/mapcontrol/isdk#directionsEvent_directionsUpdated+JS
但是当我运行我的脚本时出现错误:
错误:无法读取未定义的属性“添加”
有人可以帮帮我吗?
var map = new Microsoft.Maps.Map(document.getElementById('myMap'), {
credentials: 'Your Bing Maps Key',
center: new Microsoft.Maps.Location(47.606209, -122.332071),
zoom: 12
});
Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function () {
var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map);
// Set Route Mode to driving
directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving });
var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: 'Redmond', location: new Microsoft.Maps.Location(47.67683029174805, -122.1099624633789) });
var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle', location: new Microsoft.Maps.Location(47.59977722167969, -122.33458709716797) });
directionsManager.addWaypoint(waypoint1);
directionsManager.addWaypoint(waypoint2);
Microsoft.Maps.Events.addHandler(directionsManager, 'dragDropCompleted', function () {
console.log('Drag & Drop Complete!');
})
directionsManager.calculateDirections();
});
【问题讨论】:
标签: maps bing-maps bing bing-api