📌  相关文章
📜  将变量传递给宽度样式 div angular - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:51.838000             🧑  作者: Mango

代码示例2
@Component({
  selector: '[sidebar]',
  templateUrl: 'app/Nav/sidebar.comp.html',
  host: {
    '[style.height.px]':'0.9 * height',
    '[style.width.px]':'0.21 * width'
  }

})

export class SidebarComp {
    width: number;
    height: number;

    constructor() {
        this.height = window.innerHeight;
        this.width = window.innerWidth;
    }
}