VUE+ElementUi基础框架导入自己的ico图标

2019-01-08  本文已影响0人  一个傻乎乎的少年

小明的个人博客

在vue框架中使用ElementUi组件,某些时候在ElementUi库里找不到合适自己的ico图标怎么办呢~

1:打开阿里巴巴矢量图网站,注册登录

2:搜索自己喜欢的图标

3:在ElementUi中引用图标

[class^="custom-user"], [class*=" custom-user"] {
  font-family:"fontFamily" !important;
  /* 以下内容参照第三方图标库本身的规则 */
  font-size: 18px;
  font-style:normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}   //加入这一段代码

两个class就是你的项目名称,注意第二个class前面有个空格。font-family写你项目编辑的时候的值

[class^="custom-user"], [class*=" custom-user"] {
  font-family:"fontFamily" !important;
  /* 以下内容参照第三方图标库本身的规则 */
  font-size: 18px;
  font-style:normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.fontFamily {
  font-family: "fontFamily" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.custom-user-zhanghao:before {
  content: "\e601";
}

.custom-user-mima:before {
  content: "\e602";
}

.custom-user-mima1:before {
  content: "\e603";
}

.custom-user-zhanghao1:before {
  content: "\e604";
}

.custom-user-yanzhengma:before {
  content: "\e605";
}

.custom-user-touxiang:before {
  content: "\e606";
}
    import "../assets/icon/iconfont.css"
            <el-form-item>
                <el-input class="loginInput"
                        placeholder="邮箱/手机号码"
                        prefix-icon="custom-user-zhanghao1"  //这就是我自己的图标名称
                        v-model="userInfo.username">
                </el-input>
            </el-form-item>

小明的个人博客

上一篇 下一篇

猜你喜欢

热点阅读