[英]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.