關於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