This commit is contained in:
Taric Xin
2022-02-18 17:58:25 +08:00
parent 380f2f953d
commit 569236e6f9

View File

@ -3,6 +3,7 @@ import { Component, OnInit, ViewChild } from '@angular/core';
import { amapConf } from '@conf/amap.config';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { throwError } from 'rxjs';
import { AmapService } from '../amap.service';
declare var AMap: any;
declare var AMapUI: any;
declare var Loca: any;
@ -26,7 +27,7 @@ export class AmapPoiPickerComponent implements OnInit {
infoWindow: any;
geocoder: any;
constructor(private modalRef: NzModalRef) {}
constructor(private modalRef: NzModalRef, private service: AmapService) {}
ngOnInit(): void {
this.mapInit();
// this.PoiPicker();
@ -112,6 +113,12 @@ export class AmapPoiPickerComponent implements OnInit {
radius: 1000 //范围默认500
});
this.service.getCurrentPosition().subscribe(res => {
if (res) {
this.selectedPOI(res.position);
}
});
//选取了某个POI
poiPicker.on('poiPicked', (poiResult: any) => {
const source = poiResult.source,