MarkerWIthLabel 地图库:this.setValue 不是函数

Gia*_*ini 0 javascript google-maps google-maps-api-3 google-maps-markers

我有一个 JavaScript 应用程序,我正在尝试使用该MarkerWithLabel库向地图上的标记添加 CSS 样式。在我的 CSS 文件中,我添加了标签类:

 .labels {
   color: red;
   background-color: white;
   font-size: 10px;
   font-weight: bold;
   text-align: center;
   width: 60px;     
   border: 2px solid black;
   white-space: nowrap;
 } 
Run Code Online (Sandbox Code Playgroud)

并且,在 JavaScript 代码中,我使用的是MarkerWithLabel类而不是默认的google.maps.Marker

       var marker = new MarkerWithLabel({
           position: new google.maps.LatLng(lat, lon),
           draggable: false,
           raiseOnDrag: false,
           map: map,
           labelContent: "my label text",
           labelAnchor: new google.maps.Point(22, 0),
           labelClass: "labels",
           labelStyle: {opacity: 1.0}
        });     
Run Code Online (Sandbox Code Playgroud)

一旦我使用新类,我就会收到此错误:

TypeError: this.setValues 不是 MarkerWithLabel.gf 的函数 (js?key=MYGOOGLEKEY&callback=loadMapsApiEnd&libraries=places&_=1544699657828

我不知道这个文件是什么: MarkerWithLabel.gf

我已经包含了这个 .js 文件:https : //github.com/googlemaps/v3-utility-library/blob/master/markerwithlabel/src/markerwithlabel.js

Gia*_*ini 5

我刚刚发现问题,我不得不在 Google 地图 API 库之后包含 MarkerWithLabel.js