如何将 Font Awesome 添加到 Vue 和 Nuxt.js 项目中? [英] How to add Font Awesome to Vue and Nuxt.js project?
本文介绍了如何将 Font Awesome 添加到 Vue 和 Nuxt.js 项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试添加如下...
I was trying like add as following..
css: ['@/assets/front_end/fontawesome-free-5.15.3-web/css/fontawesome.css'],
css: [ '@/assets/front_end/fontawesome-free-5.15.3-web/css/fontawesome.css' ],
但它显示为图像
推荐答案
你可以在你的组件/布局中从cdn/local导入css
you can import the css from cdn/local in your component / layout
<style scoped>
@import 'https://pro.fontawesome.com/releases/v5.10.0/css/all.css';
// or
@import '@/assets/front_end/fontawesome-free-5.15.3-web/css/fontawesome.css';
</style>
或者你在你的 nuxt.config.js (文档一>)
or you in you nuxt.config.js (documentation)
export default {
css: [
'~/assets/front_end/fontawesome-free-5.15.3-web/css/fontawesome.css'
]
}
我建议使用 @fortawesome/vue-fontawesome 你可以利用摇树
i would suggest using @fortawesome/vue-fontawesome you can take advantage of the tree shaking
这篇关于如何将 Font Awesome 添加到 Vue 和 Nuxt.js 项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文