【问题标题】:Images do not show up in build of App IONIC 2图像不显示在 App IONIC 2 的构建中
【发布时间】:2017-03-13 06:35:22
【问题描述】:

我是 Ionic 2 的新手,我的应用程序中的图像存在一些问题。 在网上搜索我了解到图像必须放在应用程序内的 /src/assets 文件夹中。 (正确吗?

图像使用ionic serveionic lab 命令可以正常工作,但在模拟设备中或在 iPad 上使用 Ionic View 时,它们不会显示!

我在代码中引用图片:

<img src="../assets/img/ringing.png" class="circle_icons">

我该如何解决这个问题?

(下面是一些问题的截图)

Screenshot of the simulator with problems displaying images

Screenshot of the ionic serve without problems displaying images

【问题讨论】:

    标签: android ios image ionic-framework ionic2


    【解决方案1】:

    将图像放入您的资产文件夹后,只需像这样引用它们。

    <img src="assets/images/MiTUCson-quick-search.png" alt="Consulta Rapida"
    

    【讨论】:

    • 没用。如果我尝试这样做,当我在模拟器中运行时,它仍然不会渲染图像,并且在图像轮廓内会出现 Consulta Rapida 文本。
    • 您是否将图像 src 替换为您的图像?或者只是复制粘贴我复制的内容?
    • 它应该适用于任何放置
    • 我确实替换了这个名字。
    猜你喜欢
    • 1970-01-01
    • 2016-08-12
    • 1970-01-01
    • 1970-01-01
    • 2019-09-27
    • 2021-03-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多