0

我正在使用谷歌地图 api 将地图拉入 phonegap 应用程序。该地图运行良好,但我正在尝试设置自定义标记并遵循以下内容:https ://developers.google.com/maps/documentation/javascript/overlays#Icons

在您设置图像的地方,代码使用“锚”设置。这是 javascript 中的保留字,如果它留在代码中,则 javascript 会失败。

我将如何解决这个问题?

var image = {
url: 'images/beachflag.png',
// This marker is 20 pixels wide by 32 pixels tall.
size: new google.maps.Size(20, 32),
// The origin for this image is 0,0.
origin: new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
anchor: new google.maps.Point(0, 32)

};

4

1 回答 1

1

从什么时候开始锚是一个保留字?其次,如果您使用保留字作为对象中的键,只需将它们放在引号中,例如

{
'anchor': new google.maps.Point(0,32)
}
于 2013-06-19T13:41:46.937 回答