uniapp使用字体图标iconfont报错原因及解决方式


报错提示:

MiniProgramError
TypeError: Cannot read property 'getElementsByTagName' of undefined
TypeError: Cannot read property 'getElementsByTagName' of undefined
at at (app-service.js:3900:4153)
at at (app-service.js:3900:5327)
at require (WASubContext.js:2:2405363)
at at (app-service.js:3901:10)

 

原因:

1、因为资源文件放在了static的文件夹目录下,发布时这写资源文件被忽略上传了。

 

解决方式:

1、在static同级目录下新建一个iconfont的文件夹,把资源文件放到这个文件夹下

2、在App.vue 的style下引入文件的方式要用@,如:@import '@/iconfont/iconfont.css';

 


免责声明!

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



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