css - 使用 fx-layout ="column"的 Safari IOS 的 Flex 布局显示问题

标签 css ios iphone angular safari

我们目前使用 Angular 作为前端,使用 fx-layout api 来提高响应能力。

当我们使用 fxLayout="column"时,所有元素都折叠起来,似乎没有任何高度。

使用 fx-layout/flex 处理这些场景时的最佳实践是什么?

在 flex-layout 中使用 angular 9.0.0rc": "^8.0.0-beta.27

浏览器列表设置

0.5% last 2 versions Firefox ESR not dead # IE 9-11



这是来自 IOS Safari 的图像 (12)

safari

这是来自 chrome 的图片

chrome

这里是显示上图中显示列表的重复容器
  <div *ngIf="!(dataSource.loading$ | async)">
<mat-card  class="pointer mb-2" *ngFor="let quotation of dataSource.quotations$ | async"
  (click)="onClickRow(quotation)">
  <mat-card-content fxLayout="row" fxLayoutGap.gt-xs="15px" fxLayout.xs="column" fxLayoutAlign="start center"
    fxLayoutAlign.xs="center center">

    <div fxLayout="column" fxLayoutAlign="center center">
      <img class="profile-picture" *ngIf="authSvc.currentUser.hasSalesRights && quotation.customer.photoUrl"
        [src]="quotation.customer.photoUrl" alt="">
      <img class="profile-picture" *ngIf="authSvc.currentUser.hasCustomerRights && quotation.salesRep.photoUrl"
        [src]="quotation.salesRep.photoUrl" alt="">
      <img class="profile-picture" *ngIf="authSvc.currentUser.hasSalesRights && !quotation.customer.photoUrl"
        src="https://storage.googleapis.com/edcommerce/businesslogic/images/placeholder/avatar.jpg" alt="">
    </div>

    <div fxLayout="column" fxFlex fxLayoutAlign.xs="center center">
      <div fxLayout="row" *ngIf="authSvc.currentUser.hasSalesRights">
        <span class="mat-body">{{quotation.createdDate | edDate}}</span>
      </div>
      <div fxLayout="row" fxLayoutAlign.xs="center center">
        <span class="mat-h2 m-0">{{quotUtils.getVehicleDescription(quotation)}}</span>
      </div>

      <div fxLayout="row" fxLayoutGap="10px" *ngIf="authSvc.currentUser.hasSalesRights"
        fxLayoutAlign="start center">
        <span class="mat-body">{{ts('common.user.text.roles.customer')}}</span>
        <span class="mat-body">{{quotation.customer.fullName}}</span>
      </div>

      <div fxLayout="row" fxLayoutGap="10px" *ngIf="authSvc.currentUser.hasBuyerRights"
        fxLayoutAlign="start center">
        <span class="mat-body">{{ts('common.user.text.roles.sales_rep')}}</span>
        <span class="mat-body">{{quotation.salesRep.fullName}}</span>

      </div>

      <div fxLayout="row" fxLayout.xs="column" fxLayoutGap.gt-xs="10px" fxLayoutAlign="start center">
        <span class="mat-body">{{ts('page.quotations.text.step_required')}}</span>
        <span
          class="mat-body-2 color-primary">{{enumUtils.Quotation.getStatusDescByRole(quotation.status,statusTypes)}}</span>
      </div>
    </div>

  </mat-card-content>
</mat-card>
  </div>

最佳答案

safari 的问题发生在这个元素上(mat-card-content 中的第二个容器):

<div fxLayout="column" fxFlex fxLayoutAlign.xs="center center">

safari 上的 flex 在 CSS 中产生了一个奇怪的指数数字,如下所示:flex: 1 1 1.12e-16

fxFlex fxFlex="增长"在 safari 上生成这个 css flex : 1 1 100% 固定高度!

关于css - 使用 fx-layout ="column"的 Safari IOS 的 Flex 布局显示问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59759054/

相关文章:

ios - Assets 图像在 Release模式下不显示

过期处理程序运行后从后台返回时 iPhone 应用程序崩溃

jquery - 使用 json 向 RESTful WCF 发送 Post 请求

jquery - 第二轮播不工作

javascript - 在 IE 中禁用 CSS 动画效果

ios - SWIFT:如何向 NSDate 对象添加小时数

ios - 更改 ImageView 大小 Xcode

iphone - 调用选项卡栏上的 View 进行显示,而无需用户按选项卡栏(以编程方式)

javascript - jQuery取消快速悬停 Action 列表的下拉/滑动

javascript - 褪色图片被javascript下拉菜单干扰