【发布时间】:2021-03-14 13:53:23
【问题描述】:
我根据这个文档做了谷歌地图样式:https://developers.google.com/maps/documentation/javascript/styling
我在这里使用了云工具。 我已经使用了可用的模板。即这里没有 JSON 样式。
index.html
<script
src="https://maps.googleapis.com/maps/api/js?key=mykey&map_ids=mapidhere">
</script>
我在这里使用 Angular 谷歌地图组件:https://github.com/angular/components/blob/master/src/google-maps/README.md
但我没有做任何与自定义样式相关的事情。我已经重新启动了应用程序并清除了缓存。但是还没有地图样式?我也发布了更改。这里有什么线索为什么会出现这种行为?
component.html
<google-map [options]="locationModel?.googleMap?.mapOptions" height="104%" width="100%">
<map-marker #marker="mapMarker" *ngFor="let storeMarkerPosition of locationModel?.googleMap?.storeMarkerPositions"
[position]="storeMarkerPosition.markerPosition" [options]="locationModel?.googleMap?.markerOptions"
(mapClick)="openInfoCard(marker,storeMarkerPosition.store)">
</map-marker>
<map-info-window>
<app-location-details *ngIf="store" [storeModel]="store"></app-location-details>
</map-info-window>
</google-map>
【问题讨论】:
-
您的地图 html 是什么样的?这个answer 对你有帮助吗?
-
你试过在初始化对象中指定mapId吗?
-
@guzmanoj 这里没有这样的选项吗? developers.google.com/maps/documentation/javascript/reference/…
-
@rhavelka 不。我在这里不使用 JSON 样式。我使用默认模板的云工具。
-
@Sampath 确实如此,但请参阅下面的答案:)
标签: angular typescript google-maps ionic-framework styling