Fontawesome Icon Picker不渲染图标VUE2(NUXT)
与图标选择器的链接如下: https://github.com/laistomazz/font-awosh/font-awsome-picker
我使它运行,但没有向我展示图标。当我检查应该向我显示图标的元素具有所讨论的图标
<a href="#" class="item">
<I class="fas fa-arrow-alt-circle-right"></i>
</a>
以安装fontawesome,我运行以下命令
$ npm i --save @fortawesome/fontawesome-svg-core
$ npm i --save @fortawesome/free-solid-svg-icons
$ npm i --save @fortawesome/free-regular-svg-icons
$ npm i --save @fortawesome/vue-fontawesome@latest
以在Vanilla Vue上设置库时,该文档建议以下内容:
在src/main.js文件上。 来源: https://fontawesher.com/docsy.com/docs/web/web/euse-use-in-使用/vue/add-icons
import Vue from 'vue'
import App from './App'
/* import the fontawesome core */
import { library } from '@fortawesome/fontawesome-svg-core'
/* import specific icons */
import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* add icons to the library */
library.add(faUserSecret)
/* add font awesome icon component */
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
components: { App },
template: '<App/>'
})
当我使用nuxt时,我会在“插件/global-components.js”上导入组件,并且不断呈现。
有人可以帮我吗?
The link to the icon picker is the following:
https://github.com/laistomazz/font-awesome-picker
I'm making it run but it doesn't show me the icons. When I inspect the elements that should be showing me the icons has the icon in question
<a href="#" class="item">
<I class="fas fa-arrow-alt-circle-right"></i>
</a>
To install FontAwesome I run the following commands
$ npm i --save @fortawesome/fontawesome-svg-core
$ npm i --save @fortawesome/free-solid-svg-icons
$ npm i --save @fortawesome/free-regular-svg-icons
$ npm i --save @fortawesome/vue-fontawesome@latest
To set up the library on vanilla Vue, the documentation suggests this:
on src/main.js file.
source: https://fontawesome.com/docs/web/use-with/vue/add-icons
import Vue from 'vue'
import App from './App'
/* import the fontawesome core */
import { library } from '@fortawesome/fontawesome-svg-core'
/* import specific icons */
import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
/* import font awesome icon component */
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
/* add icons to the library */
library.add(faUserSecret)
/* add font awesome icon component */
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.config.productionTip = false
/* eslint-disable no-new */
new Vue({
el: '#app',
components: { App },
template: '<App/>'
})
As I'm using Nuxt I import the component on 'plugins/global-components.js' and it keeps on the not rendering.
Can someone help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要安装 @nuxtjs/fontawesome软件包。还有一个文档描述了如何与nuxt https://www.npmjs.com//包/@nuxtjs/fontawesome 。
我在这样的NUXT项目中使用字体很棒:
nuxt.config.js
fontawesome.js
You need to install @nuxtjs/fontawesome package. There also a doc described how to use FA with nuxt https://www.npmjs.com/package/@nuxtjs/fontawesome.
I use font awesome in my nuxt project like this:
nuxt.config.js
fontawesome.js