per*_*ssf 23 jsf jquery-ui primefaces
我找不到icons
像PickList
组件中存在的那样选择箭头的方法,以便在其他方面使用它们CommandButtons
.
好吧,我知道为了在CommandButton中使用图标,必须遵循以下指示:
<p:commandButton outcome="target" icon="star" title="With Icon"/>
Run Code Online (Sandbox Code Playgroud)
已经在css文件中定义了星形图标:
.star {
background-image: url("images/star.png");
}
Run Code Online (Sandbox Code Playgroud)
但我更喜欢使用与PickList组件完全相同的箭头.
Dan*_*iel 47
这里列出了所有可用的jQuery UI图标
jQueryUI Icons Cheatsheet N#1(点击Toggle text
获取图标的所有名称)
至少在<p:commandLink
你可以使用styleClass
例如图标styleClass="ui-icon ui-icon-trash"
(不记得尝试相同p:commandButton
- 总是首选<p:commandLink
)
BTW,<p:commandButton
没有outcome
属性,<p:button
有它......
此外,从PF v5.1.1开始,你也可以使用开箱即用的Font Awesome图标,通过将primefaces.FONT_AWESOME
上下文参数设置为true ,就像这样
<context-param>
<param-name>primefaces.FONT_AWESOME</param-name>
<param-value>true</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
并像这样使用它:
<p:commandButton value="Download" icon="fa fa-download" type="button"/>
Run Code Online (Sandbox Code Playgroud)
要么
<p:menuitem value="Refresh" url="#" icon="fa fa-refresh"/>
Run Code Online (Sandbox Code Playgroud)
请参阅showcase:PrimeFaces - FontAwesome - 自v5.1.1起
Fal*_*lup 31
Primefaces使用jQuery themeroller来设置UI样式.Primefaces中所有使用过的图标都来自那里.只需鼠标悬停你喜欢的图标(在themeroller中)和类似的东西:.ui-icon-arrow-1-e
会弹出.然后像这样使用它:
<p:commandButton action="target" icon="ui-icon ui-icon-arrow-1-e" value="Arrow icon"/>
Run Code Online (Sandbox Code Playgroud)