Tôi muốn thực hiện một số tác vụ dựa trên sự kiện kích thước lại cửa sổ (khi tải và động).
Hiện tại tôi có DOM của mình như sau:
<div id="Harbour">
<div id="Port" (window:resize)="onResize($event)" >
<router-outlet></router-outlet>
</div>
</div>
Sự kiện này chính xác
export class AppComponent {
onResize(event) {
console.log(event);
}
}
Làm cách nào để truy xuất Chiều rộng và Chiều cao từ đối tượng sự kiện này?
Cảm ơn.
console.log(event.target.innerWidth )
innerHeight
vàinnerWidth
tài sản ..