我想在谷歌地图上添加一个标记。问题是我的网站是“Ext.Container”而不是“Ext.map”,因为我需要一个标题栏。这就是为什么 getMap() 对我不起作用的原因。有机会让这个运行吗?
这是绘制地图的函数:
showMapCommand: function() {
var record = this.getRecord();
var map = new Ext.Map({
title: 'Map',
useCurrentLocation: false,
mapOptions: {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: new google.maps.LatLng(record.data.latitude, record.data.longitude),
mapTypeControl: false,
zoomControl: true,
overviewMapControl: false,
panControl: false,
rotateControl: false,
scaleControl: false,
controlPosition: false,
navigationControl: false,
streetViewControl: false,
backgroundColor: 'transparent',
disableDoubleClickZoom: true,
zoom: 15,
keyboardShortcuts: false,
scrollwheel: false
}
});
var marker = new google.maps.Marker ({
map: map,
animation: google.maps.Animation.DROP,
position: new google.maps.LatLng(record.data.latitude, record.data.longitude),
icon: 'resources/images/marker.png'
});
this.add([
map
]);
},
控制台的错误信息:
Uncaught Error: Invalid value for property <map>: [object Object]