Angular4_获取table/div的高度

阅读 59

2023-03-04


import { ElementRef, ViewChild } from '@angular/core';

export class viewApp{

@ViewChild('mainScreen') elementView: ElementRef;
viewHeight: number;

constructor() {
}

clickMe(){
this.viewHeight = this.elementView.nativeElement.offsetHeight;
}
}

Template:

<div class="view-main-screen" #mainScreen></div>



相关推荐

精彩评论(0)

0 0 举报