4.uniapp如何引入iconfont图标

  • Post author:
  • Post category:uniapp




1.准备一份iconfont图标库

这里我给大家省功夫,代码如下

@font-face {
  font-family: "iconfont";
  /* Project id 3231515 */
  src: url('//at.alicdn.com/t/font_3231515_h5tzgobi5z.woff2?t=1646898877456') format('woff2'),
    url('//at.alicdn.com/t/font_3231515_h5tzgobi5z.woff?t=1646898877456') format('woff'),
    url('//at.alicdn.com/t/font_3231515_h5tzgobi5z.ttf?t=1646898877456') format('truetype');
}

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

.icon-shipin:before {
  content: "\e649";
}

.icon-faxianchengse:before {
  content: "\e61e";
}

.icon-shangyiyehoutuifanhui-xianxingyuankuang:before {
  content: "\e8ef";
}

.icon-xiayiyeqianjinchakangengduo-xianxingyuankuang:before {
  content: "\e8f0";
}

.icon-shouye_huaban1:before {
  content: "\e60c";
}

.icon-zanting:before {
  content: "\e600";
}

.icon-shangyishou:before {
  content: "\e601";
}

.icon-kuaijin:before {
  content: "\e602";
}

.icon-bofang:before {
  content: "\e624";
}

.icon-sousuo:before {
  content: "\e61f";
}

.icon-yinlexiangban:before {
  content: "\e6a1";
}

.icon-yinle:before {
  content: "\e731";
}

.icon-tuijiangedan:before {
  content: "\e617";
}

.icon-MV:before {
  content: "\e64b";
}

.icon-faxian:before {
  content: "\e61d";
}



2.在app.vue下全局导入

<style>
	@import url("./static/css/iconfont.css");
	/*每个页面公共css */
	/* 在这里定义的样式,全局都能生效 */
</style>



3.直接引入

<view class="iconfont icon-shipin"></view>

最后是不是就看到图标了呢



版权声明:本文为m0_56986233原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。