springboot项目中layui的字体图标显示不出来

问题描述:在使用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项目,然后重启,就好了

发布了39 篇原创文章 · 获赞 13 · 访问量 2303

猜你喜欢

转载自blog.csdn.net/weixin_45612794/article/details/103675355