首页 > 解决方案 > 强制 Angular flex-layout 检查布局大小

问题描述

我正在使用 Angular8 的 flex-layout 并使用黄金布局在可停靠窗口中排列我的组件,我的问题是我的组件中的布局仅在我调整浏览器窗口大小时根据 flex-layout 更改,并且当我调整大小时组件窗口没有任何改变,就像我想的那样,没有通知像 flex-layout 这样的调整大小。

<div fxLayout="row wrap" fxLayout.xs="column">
  <label fxFlex="50">Name: </label>
  <mat-form-field fxFlex="50">
    <input matInput [ngModel]="_name" placeholder="Feature name" name="tst">
  </mat-form-field>

  <label fxFlex="50">Description: </label>
  <mat-form-field fxFlex="50">
    <input matInput [ngModel]="_desc" placeholder="Feature Description" name="tstD">
  </mat-form-field>
</div>

当组件的窗口宽度低于 599 像素时,我的布局应该更改column,但这仅在我调整浏览器窗口大小时才会发生。

我的想法是对的吗?如果是,我如何通知 flex-layout 组件的窗口大小变化?

标签: angularangular-flex-layout

解决方案


推荐阅读