📜  获取角宽度 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:30.351000             🧑  作者: Mango

代码示例1
// to get it on init:
public innerWidth: any;
ngOnInit() {
    this.innerWidth = window.innerWidth;
}

// if you wanna keep it updated on resize:
@HostListener('window:resize', ['$event'])
onResize(event: any) {
  this.innerWidth = window.innerWidth;
}