vue引入iconfont阿里字体图标库以及报错解决

下载阿里的字体图标库文件,放在\src\assets\font文件夹下面。

安装style-loader,css-loader和file-loader (或url-loader)  ,记得--save-dev

webpack的配置文件中添加:

{
test: /\.css$/,
use:[‘style-loader‘,‘css-loader‘]
},
{
test:/\.(ttf|eot|woff|woff2|svg)$/,
use:[‘file-loader‘]
}

入口文件main.js引入

import ‘./assets/font/iconfont.css‘;

如果已经安装了插件,webpack配置文件里面也添加,还是报以下错误:

Unexpected character ‘@‘ (2:0)
You may need an appropriate loader to handle this file type.
@font-face {font-family: "iconfont";
src: url(‘iconfont.eot?t=1529419541319‘); /* IE9*/
src: url(‘iconfont.eot?t=1529419541319#iefix‘) format(‘embedded-opentype‘), /* IE6-IE8 */
建议检查仔细webpack配置文件是否有错误,比如逗号,括号等是否漏写。
然后重新运行项目npm run dev。如果还是报错,试试将iconfont.css文件中的路径修改下,然后重新运行项目。
@font-face {font-family: "iconfont";
src: url(‘./iconfont.eot?t=1529419541319‘); /* IE9*/
src: url(‘./iconfont.eot?t=1529419541319#iefix‘)
 

原文地址:https://www.cnblogs.com/qiu-freedom/p/10348634.html

时间: 2024-07-30 02:28:43

vue引入iconfont阿里字体图标库以及报错解决的相关文章

封装字体图标库

参考了以下博客: https://blog.csdn.net/Doulvme/article/details/54290450 https://blog.csdn.net/qq_25479327/article/details/77167585 https://blog.csdn.net/muzidigbig/article/details/80371341 查找图标并下载 1.打开阿里的矢量字体图标库(http://iconfont.cn/collections)并登陆. 2.搜寻需要的图标加

小程序之使用阿里字体图标 定义主题的颜色 控制首页标题的样式 如何使用组件 水平居中和垂直居中的方式 H5 关于上线后,

项目搭建 1==> 需要创建的文件夹 styles 存放公共的样式 components 存放组件 lib第三方库的 utils 自己的帮助库 reques 自己的接口 2==>如何快速创建页面 在app.json中 写好页面路径.直接保存,就会自动生成文件 "pages/good_lis/good_lis", "pages/cart/cart" 3==>如何使用阿里字体图标 将网址(生成的http://at.alicdn.com/t/font_1

字体图标库使用方法

一些字体图标库的网站 https://icomoon.io/app/#/selecthttp://www.iconfont.cn/http://www.bootcss.com/ http://www.bootcss.com/p/cikonss/ 以第一个链接网站里的字体为例 选择自己需要图标,点击右下角下载下来 继续点击右下角--点击下载 然后下载的文件一般都是这几个基本部件 把fonts文件夹复制到自己的项目中根目录中 打开css文件 把代码复制到自己的某个css文件中,然后html引用,重点

vue引入iconfont

1.百度查询进入Iconfont阿里巴巴矢量图标库官网(https://www.iconfont.cn/) 2.搜索找到你想要的图标 3.加入购物车 4.点击购物车,选择添加到项目 3.登录你的gethub账户或者选择其他登录方式,选择添加到项目,没有项目新建项目 4.选择font class,然后点击下载到本地(下载下来压缩包,解压) 5.进入文件夹,复制所以文件到webstorm下的static目录下 6.页面直接使用,注意在图标名字前加iconfont,图标名称为github里面图标名称.

阿里云短信服务报错org.json.JSONArray.iterator()Ljava/util/Iterator

maven依赖如下: <!-- 阿里云短信sdk --> <dependency> <groupId>com.aliyun</groupId> <artifactId>aliyun-java-sdk-core</artifactId> <version>3.7.1</version> </dependency> <dependency> <groupId>com.aliyun

Aspose Linux下字体找不到报错

http://www.aspose.com/community/forums/thread/402193.aspx http://www.aspose.com/community/forums/thread/362576/aspose-and-fonts-on-linux.cannot-find-font.aspx Hi, Thanks for your posting and using Aspose.Cells for Java. Please try setting java.awt.he

解决;R语言使用sqldf库是报错&quot;Failed to connect to database: Error: Access denied for user &#39;..&#39;@&#39;localhost&#39; (using password: NO) Error in !dbPreExists : invalid argument type&quot;

原因:在使用sqldf时,不需要加载RMySQL库 解决方案:在控制台执行释放RMySQL库加载 detach("package:RMySQL", unload=T); 解决;R语言使用sqldf库是报错"Failed to connect to database: Error: Access denied for user '..'@'localhost' (using password: NO) Error in !dbPreExists : invalid argume

vue 报错解决:TypeError: Cannot read property &#39;_t&#39; of undefined&quot;

前端报错如下: [Vue warn]: Error in render: "TypeError: Cannot read property '_t' of undefined" 是在项目中用了多语言配置,vue 跟 i18n之间的兼容问题.解决方法如下: Vue.use(iView) 替换成 Vue.use(iView, { i18n: function(path, options) { let value = i18n.t(path, options) if (value !== n

VUE - 使用axios数据请求时数据绑定时 报错 TypeError: Cannot set property &#39;xxxx&#39; of undefined 的解决办法

created() { var that=this axios.get('http://jsonplaceholder.typicode.com/todos') .then(function (res) { // handle success // console.log(res); that.todos = res.data }) .catch(function (error) { // handle error console.log(error); }) .finally(function