在后续版本中,Icon组件是否考虑支持font-awesome图标?
目前的ICON数量有限,在后续版本中,Icon组件是否考虑支持font-awesome图标,以弥补目前图标不足的情况?
没必要加进来吧,自己安装 font-awesome 不是一样么
那么,像Input 组件然后使用fa的图标呢?
如果这样的话可以考虑做成另一个插件,作用就是把其他图标库的 icon 的命名规则改成 element icon 的
这个方案有考虑过,但是感觉这样修改代码不友好,建议支持fa,或者提供扩展第三方图标库的方案,谢谢!
肯定不用直接改代码,我考虑下写一个吧
我看了下 fa 是有提供 Less 和 Sass 版本的,那么完全可以自己 build 一份,我简单写了个 Less 的
[class^="el-icon-fa"], [class*=" el-icon-fa"] {
display: inline-block;
font: normal normal normal 14px/1 FontAwesome!important;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@import url("../node_modules/font-awesome/less/font-awesome");
@fa-css-prefix: el-icon-fa;
这样就可以在 Element 里使用了,例如 input 就可以写成
<el-input icon="fa-check" />
感觉没必要写成插件了
@QingWei-Li 可以考虑放到 FAQ 里面去。
Icon可以支持iconmoon搜集的svg图标吗?怎么使用呢?
https://github.com/ElemeFE/element/issues/1054#issuecomment-260294522 the code snippet is not working . did you tested it ?
我按照这种方式实现,图标还是出不来
按照@QingWei-LI给的方式,在input中使用图标显示小方块,在i标签中使用class="el-icon-fa-user"显示也是小方块。如果把fa-css-prefix改为el-iconfa,在i标签中使用class="el-iconfa-user"正常,input仍然无效。望解答
搞定了,这样写
<template>
<div id="app">
<transition name="fade" mode="out-in">
<router-view></router-view>
</transition>
</div>
</template>
<script>
export default {
}
</script>
<style lang="less">
[class^="el-icon-fa"], [class*=" el-icon-fa"] {
font-family:"FontAwesome" !important;
display: inline-block;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@import url("../node_modules/font-awesome/less/font-awesome");
@fa-css-prefix: el-icon-fa;
# **必须在最后,不然图标出不来**
@import url("../node_modules/element-ui/lib/theme-default/index.css");
</style>
what if I just use elementui by including the css file, how can I use fontawesome with elementUI? I try this <i class="fa fa-refresh fa-1" aria-hidden="true"></i> however it just shows a empty square in the button..like @ruixiu had mentioned.
any news about this issue ? I am not using this project because of this problem .
A demo: https://github.com/ElementUI/element-font-awesome
thank you @Leopoldthecoder
sass 怎么弄? 也是没出来
@maimake
<style lang="scss">
i[class^="el-icon-fa"], i[class*=" el-icon-fa"] {
font-family:"FontAwesome" !important;
display: inline-block;
font-size: inherit;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
$fa-font-path: "~font-awesome/fonts";
$fa-css-prefix: "el-icon-fa";
@import "~font-awesome/scss/font-awesome.scss";
</style>
@Wizard67 you should create a repo or include this in the official doc, great help, thanks
2.0之后的版本有点已经不支持https://github.com/ElementUI/element-font-awesome中的写法了