下载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>

然后重新构建项目!

相关推荐
伞伞悦读12 小时前
Maven 下载与配置教程(新手友好版)
maven
2301_32241428041 天前
springboot农产品交易平台的设计与实现08055-计算机毕设 原创(免费领源码+部署教程+开发环境)
java·spring boot·redis·mysql·tomcat·maven·mybatis
何中应2 天前
MySQL 连接驱动单独下载的两种方式
数据库·mysql·maven
开开心心就好2 天前
发票信息录入太麻烦?离线工具一键转表格
运维·服务器·前端·pdf·ocr·maven·intellij-idea
慧都小项4 天前
图解 MyEclipse Deployment Assembly:资源如何进入部署产物?
java·ide·tomcat·maven·myeclipse·部署排查
VX_bysjlw9856 天前
基于协同过滤的美食推荐系统的设计与实现32221-计算机毕设原创(免费领源码+带部署教程)
java·spring boot·redis·mysql·tomcat·maven·mybatis
不像程序员的程序媛6 天前
maven基础
python·pycharm·maven
2301_32241428047 天前
基于SSM框架的在线考试管理系统的设计与实现14750-计算机毕设 原创(免费领源码+部署教程+开发环境)
java·redis·mysql·tomcat·maven·mybatis·ssm
鸽鸽程序猿8 天前
【项目】【在线判题系统】公共功能
java·spring boot·maven
砚底藏山河8 天前
python量化:行情数据回溯
java·开发语言·python·金融·maven