![](/img/trans.png)
[英]Google Maps Drawing API: Invalid value for property <map>: [object Object]
[英]Google Maps JavaScript : Uncaught Error: Invalid value for property <map>: [object Object]
我正在嘗試使用Google地圖。 我已將地圖加載到面板上。
我有一個疊加窗口,我在其中要求在地圖上顯示方向的來源和目標。 我通過Ext.getCmp('GMap');
獲得了對地圖的引用Ext.getCmp('GMap');
但是,當我在chrome上運行它並檢查控制台窗口時,出現此錯誤。
Uncaught Error: Invalid value for property <map>: [object Object]
重疊式視窗的點擊處理程式的范例程式碼片段
listeners : {
tap : function() {
function showDirections(res) {
var directionsService = new google.maps.DirectionsService();
var directionsDisplay = new google.maps.DirectionsRenderer();
var map = Ext.getCmp('GMap');
directionsDisplay.setMap(map);
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
}
}
jQuery也這樣做。 當您獲取$(“#GMap”)時,您將返回一個數組,其中實際元素為[0]。 將getCmp()
的結果getCmp()
為實際的dom元素。 http://www.sencha.com/forum/showthread.php?122684-accessing-component-property-from-variable-dom-element-or-Ext.getCmp ()看起來很相似。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.