简体   繁体   English

在 vue 组件上从 font awesome 渲染社交图标

[英]Rendering social icons from font awesome on a vue component

So currently I am trying to develop my own website, and I am switching from the regular HTML,CSS, and JS paradigm to using VueJs.所以目前我正在尝试开发自己的网站,并且我正在从常规的 HTML、CSS 和 JS 范例切换到使用 VueJs。 I am struggling to transfer some of the code I have from my original HTML file to a Vue JS component, specifically my code that is rendering social icons.我正在努力将我原来的 HTML 文件中的一些代码转移到一个 Vue JS 组件,特别是我渲染社交图标的代码。 Most of the tutorials I am seeing, are rendering it on the main App.vue, however, when I am trying to render on a child component I am getting a bit stuck.我看到的大多数教程都在主 App.vue 上渲染它,但是,当我尝试在子组件上渲染时,我有点卡住了。

Here is my original HTML code:这是我原来的 HTML 代码:

Here is my configuration to import my social icons:这是我导入社交图标的配置:

Currently, I have followed the tutorial where after doing this import in my main.js, I simply tried replacing目前,我已经按照教程在我的 main.js 中执行此导入后,我只是尝试替换

<i class="fa fa-github fa-2x" aria-hidden="true"></i> 

in my component template with在我的组件模板中

<fa-icon :icon="['fas', 'github']"/>, 

however, nothing is rendering.但是,什么都没有渲染。 I didn't import anything in my child component, because I thought with the initial import's I may not have to do anything.我没有在我的子组件中导入任何东西,因为我认为使用初始导入我可能不需要做任何事情。 Would love to know any insights on going about this issue.很想知道关于这个问题的任何见解。

Assuming you're using Font Awesome 5, brand icons use the fab prefix.假设您使用的是 Font Awesome 5,品牌图标使用fab前缀。

Therefore所以

<fa-icon :icon="['fas', 'github']"/>, 

Should be应该

<fa-icon :icon="['fab', 'github']"/>, 

fab fa-github fab fa-github

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM