问题描述
从大约一个小时前开始,我一直在 Material Design 图标 cdn 上出现网络错误,因为错误名称未解决。
http://cdn.materialdesignicons.com/5.4.55/css/materialdesignicons.min.css
我想知道为什么 nuxt 应用程序使用 cdn 而不是下载的文件?
当我尝试运行 npm install nuxt-material-design-icons
或 npm install material-design-icons
时,它只是冻结..
解决方法
在nuxt.config.js的“modules”中添加“nuxt-material-design-icons”
,我想通了,
第 1 步:添加 Google 字体图标的 CDN。
export default {
head () {
return {
link: [
// Add this
{ rel: 'stylesheet',href: 'https://fonts.googleapis.com/icon?family=Material+Icons' }
],}
}
}
第 2 步:使用它(大功告成!)
<template>
// Add this
<span class="material-icons">face</span>
</template>
Protip: Here 是 Material Icon 的完整列表。