[英]how to import and use Fontello in vue/nuxt project
所以我有我的 svg 图像,我想使用 Fontello 将其转换为图标以转换并将其导入我的 nuxt 项目。 但配置似乎不起作用
这是我的nuxt.config.js文件中的内容
head: {
css: [
'~/assets/css/main.css',
'~/assets/css/animation.css',
'~/assets/css/fontello.css',
'~/assets/css/fontello-ie7.css',
'~/assets/css/fontello-ie7-codes.css', /*if IE 7 */
],
}
在我的 html 页面中,我正在使用
<i @click="goToChat" class="the-icons demo-icon icon-chat menu ic-menu"></i>
和我的 css 文件,
.demo-icon {
font-family: "fontello";
font-style: normal;
font-weight: normal;
speak: none;
display: inline-block;
text-decoration: inherit;
width: 1em;
margin-right: 0.2em;
text-align: center;
font-variant: normal;
text-transform: none;
line-height: 1em;
margin-left: 0.2em;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
问题是 css 文件无法读取font-family: "fontello";
我配置错了吗?
今晚偶然发现了同样的问题并搜索了如何做,我尝试了你的配置并且它有效..你是否还导入了 fontello 提供的包含实际字体的字体文件夹?
如果您打开 fontello.css 文件,您将看到 @font-face 属性,其中包含对 thos 字体文件的 url 引用,请确保 url 是正确的(最简单的解决方案是从 fontello.zip 导入字体和 css 文件夹),以便您的资产傻瓜看起来像这样资产 - css - 字体 - 图像
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.