Markerwithlabel没有't被创建

Markerwithlabel doesn't get created

本文关键字:创建 没有 Markerwithlabel      更新时间:2023-09-26

我正在使用以下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?

好的,我认为您缺少markerwithlabel.js链接