我不知道如何调整圆的半径
第一种方法
. html
<map-circle
(radiusChanged) = circleRedim()
[center]="center"
[options] = circleOptions >
</map-circle>
.ts
circleRedim(){ //<-void
console.log(?) //<- I vould like to log the new circle radius
}
第二种方法
. html
<map-circle #circleRef
[center]="center"
[options] = circleOptions >
</map-circle>
.ts
@ViewChild('circleRef') circleRef: google.maps.Circle;
ngAfterViewInit() {
console.log(this.circleRef); //<- circle ref isn't an istance of google.maps.Circle
}
circleRef包含一个元素
我找到了一个解决方案
<map-circle
(radiusChanged) = radiusChanged()
[center]="center"
[options] = circleOptions >
</map-circle>
@ViewChild(MapCircle) circle: MapCircle;
radiusChanged(){
if(this.circle){
console.log(this.circle.getRadius());
}
}