前言
UI 设计给的切图是 .png 格式。但想与 Element UI icon 用法类似,方案如下。
实现
步骤一
准备图片

步骤二
新建文件,可使用 CSS 预处理语言 styl 或 scss。
stylus 方式
文件 icon.styl
/* 定义一个混合 */
cfgIcon(w, h) {
display: inline-block;
width: w;
height: h;
background-size: w h;
margin-right: 8px;
}
.my-icon-loading {
background: url(./images/loading.png);
cfgIcon(10px,10px);
}

最低0.47元/天 解锁文章
214

被折叠的 条评论
为什么被折叠?



