Fontawesome Icon Picker不渲染图标VUE2(NUXT)

发布于 2025-01-31 02:21:08 字数 1638 浏览 0 评论 0原文

与图标选择器的链接如下: 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一人独醉 2025-02-07 02:21:08

您需要安装 @nuxtjs/fontawesome软件包。还有一个文档描述了如何与nuxt https://www.npmjs.com//包/@nuxtjs/fontawesome

我在这样的NUXT项目中使用字体很棒:

nuxt.config.js

import fontawesome from './fontawesome'

export default {
  buildModules: [
    '@nuxtjs/fontawesome'
  ],
  fontawesome,
}

fontawesome.js

export default {
  component: 'Icon',
  icons: {
    brands: ['faFacebookF', 'faVk', 'faInstagram', 'faTelegramPlane'],
  },
  proIcons: {
    // List used icons here
    light: ['faImage', 'faVideo'],
    solid: ['faGripVertical'],

    regular: ['faTimes', 'faSearch', 'faVolume', 'faCog', 'faExpandWide'],
  },
}

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

import fontawesome from './fontawesome'

export default {
  buildModules: [
    '@nuxtjs/fontawesome'
  ],
  fontawesome,
}

fontawesome.js

export default {
  component: 'Icon',
  icons: {
    brands: ['faFacebookF', 'faVk', 'faInstagram', 'faTelegramPlane'],
  },
  proIcons: {
    // List used icons here
    light: ['faImage', 'faVideo'],
    solid: ['faGripVertical'],

    regular: ['faTimes', 'faSearch', 'faVolume', 'faCog', 'faExpandWide'],
  },
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文