我在extjs 5应用程序中使用Sencha Architect 3.0(非触摸)。我需要使用icomoon字体来实现字形。我正在执行以下步骤。

我已经在其demo.html页面中使用了图标集及其样式。

我已经在资源位置下的css文件夹中复制了fonts文件夹和相关样式,也使用Sencha Architect添加了css。

在style.css中也找到正确的字体位置。例如

@font-face {
font-family: 'icomoon';
src:url('../fonts/icomoon.eot?-lgz2n8');
src:url('../fonts/icomoon.eot?#iefix-lgz2n8') format('embedded-opentype'),
    url('../fonts/icomoon.ttf?-lgz2n8') format('truetype'),
    url('../fonts/icomoon.woff?-lgz2n8') format('woff'),
    url('../fonts/icomoon.svg?-lgz2n8#icomoon') format('svg');
font-weight: normal;
font-style: normal;}


在样式css中,我有以下类别,例如:

[class^="icon-"], [class*=" icon-"] {
font-family: 'icomoon';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;

/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

.icon-2008:before {
    content: "\e600";
}


在Ext按钮中,我将iconCls属性设置为“ icon-2008”,并将字形设置为e600。

它向我显示了按钮上的字形,但按钮的背景中带有&#e600。

在Sencha CMD中:sencha应用刷新就可以了。

请提出我做错了什么,或者应该采取什么步骤?

谢谢

最佳答案

将与icomoon相关的CSS包含在app.json或index.html中
在您的app.js或application.js中包含此行
Ext.setGlyphFontFamily('icomoon');
在按钮cfg中,无需提及iconCls即可获取字形。您可以改为仅应用字形cfg。


glyph:0xe600-(非字符串值)

要么

字形:'600 @ icomoon'-(字符串值)

关于css - Sencha Architect ExtJs中的Icomoon字形应用程序不起作用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32602834/

10-11 14:08