问题描述:在使用layui开发页面时,js和css路径正确,包结构也跟官网的一样,但是图标就是出不来,像下图中一样。

问题定位:
F12开发者控制台打印如下日志:

问题分析:这是因为经过maven的filter,会破坏font文件的二进制文件格式,所以前台解析出错
解决方案:pom.xml中加上这个插件
<!--解决图标不能回显问题-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>woff</nonFilteredFileExtension>
<nonFilteredFileExtension>woff2</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
clean项目,然后重启,就好了
本文描述了在使用layui框架开发网页时遇到的图标无法正常显示的问题,通过F12开发者工具发现错误日志,分析原因在于Maven构建过程中字体文件格式被破坏。提供了解决方案,在pom.xml中添加特定插件配置,避免字体文件被过滤,重启项目后问题得以解决。
6469





