0

我正在使用 Ionic 版本 5.4.16tag 并使用 来在我的网络应用程序中显示图像,但是当我加载页面时图像显示为损坏的图像,为什么会发生这种情况以及如何修复它;图片附在下面:这是我用来创建图片的代码:




<!-- language: tsx -->

    <IonRow className="ion-justify-content-center ion-text-center">
    <IonCol></IonCol>
    <IonCol size="3">
      <IonImg src="icon.png" />
      <div className="spinner">erie</div>
    </IonCol>
    <IonCol></IonCol>
    </IonRow>



在此处输入图像描述

4

1 回答 1

1

在 IonImg 组件中使用之前,您必须导入图像。例如:

import myImage from './icon.png'

...

<IonImg src={myImage} />
于 2021-04-15T01:29:10.197 回答