我的图像没有显示在我的移动 Cordova 版本中,我将不胜感激。在 Phonegap 中需要放置 images in the root . Cordova 也是这样吗?
我的结构如下:
/www
index.html
/assets
/img
我从我的 index.html 文件中调用这样的图像:
<img src="assets/img/myfile.png" />
图像无法加载是否有原因?我检查了文件权限。我的猜测是我需要更改我的 config.xml。这些“允许/访问”规则是否足够?
<allow-navigation href="file://*/*"/>
<allow-navigation href="*"/>
<allow-intent href="file://*/*"/>
<allow-intent href="*"/>
<access origin="file://*/*"/>
<access origin="*"/>
最佳答案
如果您使用的是 Visual Studio,请不要忘记将图像添加到解决方案中,而不仅仅是将它们放入正确的文件夹中。如果它们不是解决方案的一部分,则它们不能在艺术 Assets 编译期间捆绑,因此不会出现在部署中。
关于ios - 使用 Cordova ios 构建时未显示图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35531687/