简体   繁体   English

Ionic 4 网格 - 每行仅显示一列

[英]Ionic 4 grid - displaying only one column per row

I would like to display the "Shift' column below and have it take up the entire row. However, the other columns 'admindesc' is coming up on the side of it. How do I keep the 'Shift' column on its own row all by itself?我想在下面显示“Shift”列并让它占据整行。但是,其他列“admindesc”出现在它的一侧。如何将“Shift”列保留在自己的行上全靠自己?

<ion-content>
  <ion-grid>
    <ion-row *ngFor="let customer of customers; let i=index">
      <ion-col *ngIf="customer.admin==true">
        <ion-card>
          <ion-card-content>
            Shift: {{customer.status}}
          </ion-card-content>
        </ion-card>
      </ion-col>
      <ion-col>
        <ion-label *ngIf="customer.admin==true">{{customer.admindesc}}admin</ion-label>
        {{customer.fullname}}-{{customer.cellphone}}--{{customer.admin}}
      </ion-col>
      <ion-col>
        <ion-checkbox></ion-checkbox>
      </ion-col>
    </ion-row>
  </ion-grid>
</ion-content>

You can put the structural directive for loop in an <div *ngFor='...'> so that your code looks like this.您可以将结构指令 for 循环放在<div *ngFor='...'>以便您的代码看起来像这样。 This will place your shift column in a row of its own and the other content in the second row throughout the iteration.这将在整个迭代过程中将您的 shift 列放在它自己的一行中,并将其他内容放在第二行中。

<ion-content>
  <ion-grid>
    <div *ngFor="let customer of customers; let i=index">
      <ion-row>
        <ion-col *ngIf="customer.admin==true">
         <ion-card>
           <ion-card-content>
             Shift: {{customer.status}}
           </ion-card-content>
         </ion-card>
        </ion-col>
      </ion-row>
      <ion-row>
        <ion-col>
          <ion-label *ngIf="customer.admin==true">{{customer.admindesc}}admin</ion-label>
            {{customer.fullname}}-{{customer.cellphone}}--{{customer.admin}}
        </ion-col>
        <ion-col>
          <ion-checkbox></ion-checkbox>
        </ion-col>
      </ion-row>
    </div>
  </ion-grid>
</ion-content>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM