下载element-ui 资源,图标 element-icons.woff,element-icons.ttf 无法解码文件字体

css下载地址: https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/index.css

js下载地址: https://unpkg.com/element-ui@2.15.14/lib/index.js

图标及文字文件下载地址:

element-icons.woff::

​ https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/fonts/element-icons.woff ​

element-icons.ttf:

https://unpkg.com/element-ui@2.15.14/lib/theme-chalk/fonts/element-icons.ttf

访问项目发现icon图标无法现在!

浏览器控制台报错:

Failed to decode downloaded font: http://localhost:8080/demo/css/ui/element/fonts/element-icons.woff

报错原因:Maven构建过程中,默认会对资源文件过滤处理,有些文件内容或字体被Maven处理之后不能正常解析。

解决方式:

在pom.xml文件中添加 maven-resources-plugin 插件

复制代码
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-resources-plugin</artifactId>
    <version>2.6</version>
    <configuration>
        <nonFilteredFileExtensions>
            <nonFilteredFileExtension>ico</nonFilteredFileExtension>
            <nonFilteredFileExtension>otf</nonFilteredFileExtension>
            <nonFilteredFileExtension>woff</nonFilteredFileExtension>
            <nonFilteredFileExtension>woff2</nonFilteredFileExtension>
            <nonFilteredFileExtension>eot</nonFilteredFileExtension>
            <nonFilteredFileExtension>svg</nonFilteredFileExtension>
            <nonFilteredFileExtension>ttf</nonFilteredFileExtension>
        </nonFilteredFileExtensions>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>

然后重新构建项目!

相关推荐
小宇宙Zz3 天前
Maven依赖冲突
java·服务器·maven
砚底藏山河3 天前
沪深A股:如何获取基金持股数据
java·python·数据分析·maven
一勺菠萝丶3 天前
Maven SNAPSHOT 父 POM 无法解析问题排查
java·maven
我登哥MVP3 天前
SpringCloud Alibaba 核心组件解析:服务链路追踪
java·spring boot·后端·spring·spring cloud·java-ee·maven
南部余额4 天前
Maven Archetype 项目模板
java·maven·项目·archetype
梦想的旅途24 天前
企业微信外部群自动化:一期交付应聚焦双向会话闭环
java·开发语言·机器人·自动化·maven·企业微信
vx-Biye_Design4 天前
springboot安阳地区研学旅游服务小程序-计算机毕业设计源码12785
java·vue.js·windows·spring boot·tomcat·maven·mybatis
Clang's Blog4 天前
Ubuntu(20.04/22.04/24.04)国内环境一键安装 Docker、JDK17 和 Maven
ubuntu·docker·maven
编程的一拳超人4 天前
Maven 国内高速镜像推荐(按速度排序)
java·maven
chushiyunen5 天前
vue el-pagination实现分页
javascript·vue.js·elementui