源码论坛,商业源码下载,尽在锦尚中国商业源码论坛
标题:
浏览器警告Failed to decode downloaded font 系统页面字体图标加载不出来 问题总结
[打印本页]
作者:
洪七公
时间:
2023-7-26 20:56
标题:
浏览器警告Failed to decode downloaded font 系统页面字体图标加载不出来 问题总结
1.后台拦截,此时警告后往往是localhost:8080一类的地址
解决方法:maven放行,或者springSecurity放行
maven放行:在pom文件中(网上抄来的)
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>static/**/*.woff</exclude>
<exclude>static/**/*.woff2</exclude>
<exclude>static/**/*.ttf</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>static/**/*.woff</include>
<include>static/**/*.woff2</include>
<include>static/**/*.ttf</include>
</includes>
</resource>
复制代码
2. 前端问题 ,此时警告后往往跟的是url类型的,如application.....
可能是打包问题,我自己是跟着B站一个教程做的Vue+SpringBoot+ElementUI的系统
在vue项目中的webpack.base.conf.js中的module里,将原有的url-loader注释掉,用file-loader解析这些字体文件即可
//注释的原代码(url-loader)
/*{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}
},*/
//用file-loader
{
//是为了解析字体的模块,遇到“eot|svg|ttf|woff|woff2”,用file-loader模块解析,正则表达式
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader'
}
复制代码
欢迎光临 源码论坛,商业源码下载,尽在锦尚中国商业源码论坛 (https://bbs.52jscn.com/)
Powered by Discuz! X3.3