Angular 使用角5获取元素的全宽
如何获得一个角为5的元素的全宽,而不仅仅是计算的宽度?现在我只得到客户端的宽度,而不是元素的全宽 这个代码怎么了Angular 使用角5获取元素的全宽,angular,ionic-framework,Angular,Ionic Framework,如何获得一个角为5的元素的全宽,而不仅仅是计算的宽度?现在我只得到客户端的宽度,而不是元素的全宽 这个代码怎么了 @ViewChild('box') box: ElementRef; ... this.boxWidth = this.box.nativeElement.clientWidth; HTML {{i} 使用offsetWidth。它还将包括边框宽度 @ViewChild('box') box: ElementRef; this.boxWidth = this.box.na
@ViewChild('box') box: ElementRef;
...
this.boxWidth = this.box.nativeElement.clientWidth;
HTML
{{i}
使用offsetWidth。它还将包括边框宽度
@ViewChild('box') box: ElementRef;
this.boxWidth = this.box.nativeElement.offsetWidth;
@ViewChild('box') box: ElementRef;
this.boxWidth = this.box.nativeElement.offsetWidth;