我正在使用以下api包装器:https://github.com/jmelosegui/GooglemapMvc
使用api创建带标签的标记是不可能的,所以我自己修改了javascript。
这很好(创建一个普通标记):
var markerOptions = {
position: new google.maps.LatLng(this.Latitude, this.Longitude),
map: this.EnableMarkersClustering ? null : this.Map,
title: this.Title,
clickable: this.Clickable,
draggable: this.Draggable,
};
// create marker
this.GMarker = new Marker(markerOptions);
这不是(创建带标签的标记):
// create marker
this.GMarker = new MarkerWithLabel({
position: new google.maps.LatLng(this.Latitude, this.Longitude),
map: this.EnableMarkersClustering ? null : this.Map,
title: this.Title,
clickable: this.Clickable,
draggable: this.Draggable,
// Self added
raiseOnDrag: true,
labelContent: "A",
labelStyle: { opacity: 0.75 },
labelAnchor: new google.maps.Point(22, 0),
labelClass: "labels", // the CSS class for the label
labelInBackground: false,
labelVisible: true,
optimized: false,
icon: {}
});
// Anything below here won't be reached!
console.log("marker!");
为什么不到达console.log?