关于ionic 打包后 background-image 无法显示 的问题


这几天费劲心思,终于把ionic 项目打包生成 本地app,但是安卓手机安装以后,我所有的雪碧图的 icon ,竟然无法显示;到处搜索答案,都没有什么可行的,都是说什么ionic版本不对,android手机版本不兼容。 

最后,在stack overflow 上,尝试了 RILEY 这个位哥们的回答,确实完美的解决了这个问题:

Its not the size of the image that prevents it from displaying in ionic2.This is what you should do when the local image is not displaying:

remove the trailing ../ before your image folder or image name.The App already knows that all image are stored by default in the www folder.So you will have to use a format like this for all your images to display: Fir icons: and for background image;

意思是说本地app已经知道所有图片默认的存储路径是www 文件夹下,并不需要使用相对路径;所以解决方法是去掉 ../;

这是纠结了一下午的问题,记录下来,希望也对大家有所帮助!

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM