0

我在 Angular 4 中使用 flex 布局模块,我在桌面模式下并排尝试卡片布局需要显示,并且在移动模式下它应该是一比一,但它对我不起作用请建议正确的代码。

下面是我的代码:

<div fxLayout="row" fxLayout-gt-xs="column">
     <mat-card fxflex fxflex-gt-xs="100"  fxFlex="33.33%">
          <h2>Card title #1</h2>
              <mat-card-content>
                  <p>Some content</p>
              </mat-card-content>
     </mat-card>
     <mat-card fxflex  fxflex-gt-xs="100" fxFlex="33.33%">
          <h2>Card title #2</h2>
              <mat-card-content>
                   <p>Some content</p>
              </mat-card-content>
     </mat-card>

使用这个版本: @angular/flex-layout:^2.0.0-beta.9

4

1 回答 1

0

默认情况下,块元素放置在不同的行中。您只需要处理 xs 屏幕的方向。

用这个:-

<div fxLayout.xs="column">
<mat-card fxflex fxflex-gt-xs="100" fxFlex="33.33%">
    <h2>Card title #1</h2>
    <mat-card-content>
        <p>Some content</p>
    </mat-card-content>
</mat-card>
<mat-card fxflex fxflex-gt-xs="100" fxFlex="33.33%">
    <h2>Card title #2</h2>
    <mat-card-content>
        <p>Some content</p>
    </mat-card-content>
</mat-card>
</div>
于 2018-02-24T11:49:18.090 回答