首页 > 解决方案 > Ionic 3:图像文件未加载到设备中

问题描述

我不知道出了什么问题。当我尝试ionic serve一切正常加载。但是,当我尝试在 android 设备上运行它时,没有任何图像加载,而是显示错误Failed to load resource: net::ERR_FILE_NOT_FOUND没有正确加载图像。

我的 scss 文件

.bg-image{
        background-image: url('../../assets/imgs/bgimage.png');
        background-repeat: no-repeat;
        background-size: 200%;
        background-attachment: fixed;
        position: absolute;

我的 html 文件

<div class="bg-image">
.
.
</div>

无法弄清楚请帮忙。

标签: cssionic-frameworksassionic3

解决方案


Try changing the path keep images in main www/assets/img folder and then set

background-image: url('assets/img/bgimage.png');

推荐阅读