在离子网格中设置相同尺寸的离子卡

Set ion-card at same size in a a ion-grid

你好,我正在构建一个目录应用程序,我正在展示一些项目,但它们以不同的尺寸显示,我无法实现让离子卡以相同的尺寸显示

<ion-content [fullscreen]="true">

  <ion-grid > 
      <ion-row *ngFor = 'let item of items'>
          <ion-card>
            <ion-img  [src]='item.imagePath'></ion-img>
            <ion-header>
              <ion-card-title class='ion-text-center'> {{ item?.title }} </ion-card-title>
              <ion-card-subtitle class='ion-text-center'> {{ item?.price }} </ion-card-subtitle>
            </ion-header>
            <!-- <ion-card-content class='ion-text-wrap'> {{ item?.description }} </ion-card-content> -->
          </ion-card>
      </ion-row>

  </ion-grid>

</ion-content>

外观如何 enter image description here

您需要将每一行换成一列。

<ion-grid>
 <ion-col size="12">
  <ion-row *ngFor = let item of items'>
   <ion-card>
    <ion-img  [src]='item.imagePath'></ion-img>
         <ion-header>
          <ion-card-title class='ion-text-center'> {{ item?.title }} </ion-card-title>
          <ion-card-subtitle class='ion-text-center'> {{ item?.price }} </ion-card-subtitle>
        </ion-header>
        <!-- <ion-card-content class='ion-text-wrap'> {{ item?.description }} </ion-card-content> -->
      </ion-card>
  </ion-row>
 </ion-col>
</ion-grid>

你 CSS 这样做....

 ion-card{
  display: flex;
  flex-direction: column;
  width: 100% !important;
  margin: 0 !important;
 }