extjs - 如何在 Ext.panel.Tool 中使用 font Awesome

标签 extjs font-awesome extjs6

我需要自定义 Ext.panel.Tool 以在网格标题中显示来自 font Awesome 的图标“fa fa-file-excel-o”。根据我在网上找到的内容,我声明了该工具:

    header: {
    itemPosition: 1, // after title before collapse tool
    items: [{
        xtype: 'tool',
        type: 'export',
        cls:'component-tool-export',
        handler: 'doExportData'
    }]
    },

还有CSS:

.component-tool-export .x-tool-export{
  background-image:none !important;
  content: "\f1c3" !important;
}

该工具在那里,我可以单击它,但不显示图标。谁能给我一些提示来解决这个问题?

最佳答案

您没有向 :before 伪元素添加内容,这是显示内容所必需的。您可以使用以下 CSS:

.component-tool-export .x-tool-export{
  background-image:none !important;
  font: 16px/1 FontAwesome;
}
.component-tool-export .x-tool-export:before{
  content: "\f1c3" !important;
}

但是如果您已经使用 Sencha CMD,我建议您遵循 Sencha 自己的 SASS 文件并利用 Sencha Fashion 的完整功能集:

$tool-export-glyph: dynamic($fa-var-file-excel-o $tool-glyph-font-size $font-icon-font-family);

.#{$prefix}tool-export {
    @include font-icon($tool-export-glyph);
    background: none;
}

关于extjs - 如何在 Ext.panel.Tool 中使用 font Awesome,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34139191/

相关文章:

html - 使用 font awesome 将工具栏与搜索文本框对齐

html - 堆叠 fa-circle-o 和其他图标,同时保持垂直和水平对齐

html - 为什么我的 Font Awesome 图标在页面加载时消失了?

extjs - 如何隐藏网格列菜单中的特定列(ExtJS 6.5.3)?

Extjs 6 使用 Ext.define 定义一个链式商店

javascript - 获取和发送 id 标记字段值。 Extjs

extjs - 修改 initComponent() 中的项目

extjs - 如何获取实例化组件的 xtype?

ExtJs 海王星主题

javascript - Uncaught Error : [Ext. 创建] 无法识别的类名/别名 : MyApp. store.LibraryFolderTreeStore