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

css下载地址: https://unpkg.com/[email protected]/lib/theme-chalk/index.css

js下载地址: https://unpkg.com/[email protected]/lib/index.js

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

element-icons.woff::

​ https://unpkg.com/[email protected]/lib/theme-chalk/fonts/element-icons.woff ​

element-icons.ttf:

https://unpkg.com/[email protected]/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>

然后重新构建项目!

相关推荐
2301_7943339110 分钟前
Maven 概述、安装、配置、仓库、私服详解
java·开发语言·jvm·开源·maven
越来越无动于衷13 分钟前
maven私服
java·maven
橘子编程8 小时前
Maven从入门到精通指南
java·maven
BAStriver9 小时前
PKIX path building failed问题小结
java·maven
xiaogg36781 天前
vue+elementui 网站首页顶部菜单上下布局
javascript·vue.js·elementui
大力水手偷吃菠菜变成米老鼠2 天前
maven 1.0.0&&idea的使用说明
maven
酷爱码2 天前
IDEA 中 Maven Dependencies 出现红色波浪线的原因及解决方法
java·maven·intellij-idea
我的心巴3 天前
vue-print-nb 打印相关问题
前端·vue.js·elementui
Amy_cx3 天前
在表单输入框按回车页面刷新的问题
前端·elementui
xiaogg36783 天前
网站首页菜单顶部下拉上下布局以及可关闭标签页实现vue+elementui
javascript·vue.js·elementui