0

我的年度股东大会方法:

private setCurrentLocation() {
    if ('geolocation' in navigator) {
      navigator.geolocation.getCurrentPosition((position) => {
        this.latitude = position.coords.latitude;
        this.longitude = position.coords.longitude;
        this.zoom = 18;
        this.getAddress(this.latitude, this.longitude);
      });
    }
  }

在 localhost:4200 中运行时工作正常并加载地图,但当我使用命令“ng serve --host 192.168.*.**”运行时。方法找不到位置,也找不到纬度和经度。如何解决这个问题。第一次没有显示地图。

4

0 回答 0