以下代码工作:
function()
{
var Marker = new google.maps.Marker();
var MarkerOptions = {};
MarkerOptions.map = my_map;
MarkerOptions.position = new google.maps.LatLng(0,0);
MarkerOptions.animation = google.maps.Animation.DROP;
MarkerOptions.clickable = true;
MarkerOptions.cursor = 'pointer';
Marker.smallicon = [{
anchor:null,
origin:null,
scaledSize:null,
size:new google.maps.Size(20,32),
url:'http://maps.gstatic.com/mapfiles/markers2/marker_sprite.png'
}];
Marker.setOptions(MarkerOptions);
}
而添加这一行后,控制台拍摄充满错误
function()
{
var Marker = new google.maps.Marker();
var MarkerOptions = {};
MarkerOptions.map = way_map;
MarkerOptions.position = new google.maps.LatLng(0,0);
MarkerOptions.animation = google.maps.Animation.DROP;
MarkerOptions.clickable = true;
MarkerOptions.cursor = 'pointer';
Marker.smallicon = [{
anchor:null,
origin:null,
scaledSize:null,
size:new google.maps.Size(20,32),
url:'http://maps.gstatic.com/mapfiles/markers2/marker_sprite.png'
}];
Marker.setIcon(Marker.smallicon);
Marker.setOptions(MarkerOptions);
}
我不太了解它,它可以使用,google.maps.MarkerImage
但在参考中写入
表示标记图标或阴影图像的结构。此类已弃用,取而代之的是 Icon。
所以我尝试使用 Icon,他们已将其从构造函数更改为 Object,因此更改了调用模型。