QA_*_*Col 2 icons primefaces font-awesome
我正在检查以下问题: 如何将Webjars.org中的Font Awesome与JSF一起使用 ant此问题: PrimeFaces中的FontAwesome 及其答案/sf/answers/2314909341/
嗨,我想使用https://fontawesome.com/changelog/latest 5.5版本的新图标
在我的pom.xml
档案专案中...
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.extensions</groupId>
<artifactId>primefaces-extensions</artifactId>
<version>6.2</version>
</dependency>
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.webjars/font-awesome -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>5.5.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在我的web.xml
档案中
<!-- Fontawesome -->
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
在我的facelet .xhtml中
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/templates/template.xhtml">
<ui:define name="body">
<h:outputScript library="webjars" name="font-awesome/5.5.0/js/all.js"/>
...
<p:spacer width="10"/>6
<h:outputText styleClass="fas fas-map"/>7
<h:outputText styleClass="fa fa-venus-mars fa-icon-custom" />
<h:outputText styleClass="fa fa-female fa-icon-custom" />
<h:outputText styleClass="fa fa-male fa-icon-custom" />
Run Code Online (Sandbox Code Playgroud)
注意:我正在使用fas
和fa
,但都无法正常工作
就像显示我的图像一样,所有图标都失败了
如何解决呢?
PF 6.2.12和PF 6.3中增加了使用FontAwesome 5的功能。查看此票证并提交,它增加了以下功能:
https://github.com/primefaces/primefaces/issues/4276
https://github.com/primefaces/primefaces/commit/c28c0bccc615bffb99c30825c8c7d8084c3a72da
在web.xml中关闭默认的PF支持:
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>false</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
更新您的pom.xml。
<dependency>
<groupId>org.webjars</groupId>
<artifactId>font-awesome</artifactId>
<version>5.8.2</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
对JSF使用正确的WebJars CSS。
<h:outputStylesheet library="webjars" name="font-awesome/5.8.2/css/all.min-jsf.css" />
<h:outputStylesheet library="webjars" name="font-awesome/5.8.2/css/v4-shims.min-jsf.css" />
Run Code Online (Sandbox Code Playgroud)
注意:由于现在Font Awesome已分为“ fas”,“ fab”等不同类别,因此您必须更改“ fa”。请在此处查看文档。
归档时间: |
|
查看次数: |
893 次 |
最近记录: |