【发布时间】:2019-04-10 16:11:45
【问题描述】:
更新:我已经给出了答案。请看。
原问题:
你能告诉我为什么leaflet map 没有显示在完整的地图区域中吗?
.html
<ion-content padding>
<div style="height: 100%;width:100%" leaflet [leafletOptions]="options" *ngIf="options" [leafletCenter]="center">
</div>
</ion-content>
.ts
init(): void {
this.options = {
layers: [
tileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", { maxZoom: 18, attribution: "..." })
],
zoom: 10,
center: this.center = latLng(Number(this.activatedRoute.snapshot.paramMap.get("latitude")), Number(this.activatedRoute.snapshot.paramMap.get("longitude"))),
attributionControl: false,
};
}
用户界面
请看图片。 transform 似乎有问题。默认为0,0,0。我已经像这样在浏览器上手动更改了它。那么如何将其设置到地图上呢?
【问题讨论】:
-
@ghybs 请查看我的更新并给我建议。
-
@IvanSanchez 没用。这对我有用:stackoverflow.com/a/55622789/1077309
标签: angular typescript leaflet maps ionic4