google maps markerwithlabel不在mvc中显示

时间:2015-11-20 03:33:17

标签: asp.net-mvc google-maps

我不确定如何使用这个外部库,似乎我需要另外请求才能显示标记,但我不确定在mvc中执行此操作的最佳方法。

我得到的错误是:MarkerLabel_.getSharedCross is not a function

点只包含Lats / Lngs数组

function initMap() {
    map = new google.maps.Map(document.getElementById('map'), {
        center: points[0],
        zoom: 10
    });
    for (var i = 0; i < points.length; i++) {
        var marker = new MarkerWithLabel({ 
            position: points[i],
            draggable: true,
            map: map,
            labelContent: "$425K",
            labelAnchor: new google.maps.Point(22, 0),
            labelClass: "labels", // the CSS class for the label
            labelStyle: {opacity: 0.75},
            icon: "../Content/Images/map-icon.png"
        });
        marker.setMap(map);
    }
}
<script src="https://maps.googleapis.com/maps/api/js?key=MyKey&callback=initMap"
    async defer></script>
<script src="~/Scripts/Custom/marker-with-label.js"></script>

0 个答案:

没有答案