• 单选-fill
    
  • 单选
    
  • 方形未选中
    
  • 方形选中-fill
    
  • 方形选中
    
  • 加号
    
  • 加号1
    
  • 加号2-fill
    
  • 减号
    
  • 圆形未选中
    
  • 更多
    
  • 首页-fill
    
  • 首页
    
  • Android更多
    
  • pull_down
    
  • frown
    
  • meh
    
  • smile
    
  • add user
    
  • delete team
    
  • delete user
    
  • addteam
    
  • user
    
  • team
    
  • frown-fill
    
  • meh-fill
    
  • smile-fill
    
  • delete
    
  • close
    
  • view
    
  • view_off
    
  • message
    
  • time
    
  • cart_empty
    
  • cart
    
  • search
    
  • edit
    
  • link
    
  • share
    
  • setting
    
  • upload
    
  • download
    
  • play
    
  • region
    
  • phonecall
    
  • lock
    
  • unlock
    
  • image
    
  • list
    
  • refresh
    
  • close_filled
    
  • check
    
  • close
    
  • check_filled
    
  • forbidden
    
  • forbidden_filled
    
  • info_filled
    
  • info
    
  • help_filled
    
  • help
    
  • caution
    
  • caution_filled
    
  • like
    
  • like_filled
    
  • star
    
  • star_filled
    
  • arrow_up
    
  • arrow_left
    
  • arrow_down
    
  • arrow_right
    
  • page_first
    
  • down_to_bottom
    
  • up_to_top
    
  • page_last
    
  • page_turning_left
    
  • page_turning_right
    
  • show_less
    
  • show_more
    
  • social_sina
    
  • social_google
    
  • social_github
    
  • social_wechat
    
  • go-to-link
    
  • benefits
    
  • alipay
    
  • taobao
    
  • mute mode
    
  • volume
    
  • info
    
  • info_filled
    
  • pull_down
    

Unicode 引用


Unicode 是字体在网页端最原始的应用方式,特点是:

  • 兼容性最好,支持 IE6+,及所有现代浏览器。
  • 支持按字体的方式去动态调整图标大小,颜色等等。
  • 但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。

注意:新版 iconfont 支持多色图标,这些多色图标在 Unicode 模式下将不能使用,如果有需求建议使用symbol 的引用方式

Unicode 使用步骤如下:

第一步:拷贝项目下面生成的 @font-face

@font-face {
  font-family: 'iconfont';
  src: url('iconfont.eot');
  src: url('iconfont.eot?#iefix') format('embedded-opentype'),
      url('iconfont.woff2') format('woff2'),
      url('iconfont.woff') format('woff'),
      url('iconfont.ttf') format('truetype'),
      url('iconfont.svg#iconfont') format('svg');
}

第二步:定义使用 iconfont 的样式

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

第三步:挑选相应图标并获取字体编码,应用于页面

<span class="iconfont">&#x33;</span>

"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

  • 单选-fill
    .icon-radio-filled
  • 单选
    .icon-radio-disabled
  • 方形未选中
    .icon-checkbox
  • 方形选中-fill
    .icon-checkbox-filled
  • 方形选中
    .icon-checkbox-disabled
  • 加号
    .icon-jiahao2
  • 加号1
    .icon-jiahao
  • 加号2-fill
    .icon-jiahao2-filled
  • 减号
    .icon-jianhao
  • 圆形未选中
    .icon-radio
  • 更多
    .icon-gengduo
  • 首页-fill
    .icon-home-filled
  • 首页
    .icon-home
  • Android更多
    .icon-gengduo2
  • pull_down
    .icon-pulldown
  • frown
    .icon-frown
  • meh
    .icon-meh
  • smile
    .icon-smile
  • add user
    .icon-adduser
  • delete team
    .icon-deleteteam
  • delete user
    .icon-deleteuser
  • addteam
    .icon-addteam
  • user
    .icon-user
  • team
    .icon-team
  • frown-fill
    .icon-frown-filled
  • meh-fill
    .icon-meh-filled
  • smile-fill
    .icon-smile-filled
  • delete
    .icon-delete
  • close
    .icon-close-simple
  • view
    .icon-view
  • view_off
    .icon-view-off
  • message
    .icon-message
  • time
    .icon-time
  • cart_empty
    .icon-cart-empty
  • cart
    .icon-cart
  • search
    .icon-search
  • edit
    .icon-edit
  • link
    .icon-link
  • share
    .icon-share
  • setting
    .icon-setting
  • upload
    .icon-upload
  • download
    .icon-download
  • play
    .icon-play
  • region
    .icon-region
  • phonecall
    .icon-phonecall
  • lock
    .icon-lock
  • unlock
    .icon-unlock
  • image
    .icon-image
  • list
    .icon-list
  • refresh
    .icon-refresh
  • close_filled
    .icon-close-filled
  • check
    .icon-check
  • close
    .icon-close
  • check_filled
    .icon-check-filled
  • forbidden
    .icon-forbidden
  • forbidden_filled
    .icon-forbidden-filled
  • info_filled
    .icon-info-filled
  • info
    .icon-info
  • help_filled
    .icon-help-filled
  • help
    .icon-help
  • caution
    .icon-caution
  • caution_filled
    .icon-caution-filled
  • like
    .icon-like
  • like_filled
    .icon-like-filled
  • star
    .icon-star
  • star_filled
    .icon-star-filled
  • arrow_up
    .icon-arrow-up
  • arrow_left
    .icon-arrow-left
  • arrow_down
    .icon-arrow-down
  • arrow_right
    .icon-arrow-right
  • page_first
    .icon-page-first
  • down_to_bottom
    .icon-down-to-bottom
  • up_to_top
    .icon-up-to-top
  • page_last
    .icon-page-last
  • page_turning_left
    .icon-page-turn-left
  • page_turning_right
    .icon-page-turn-right
  • show_less
    .icon-show-less
  • show_more
    .icon-show-more
  • social_sina
    .icon-social-sina
  • social_google
    .icon-social-google
  • social_github
    .icon-social-github
  • social_wechat
    .icon-social-wechat
  • go-to-link
    .icon-go-to-link
  • benefits
    .icon-benefits
  • alipay
    .icon-alipay
  • taobao
    .icon-taobao
  • mute mode
    .icon-volume-off
  • volume
    .icon-volume
  • info
    .icon-info-down
  • info_filled
    .icon-info-down-filled
  • pull_down
    .icon-pullup

font-class 引用


font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。

与 Unicode 使用方式相比,具有如下特点:

  • 兼容性良好,支持 IE8+,及所有现代浏览器。
  • 相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。
  • 因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。
  • 不过因为本质上还是使用的字体,所以多色图标还是不支持的。

使用步骤如下:

第一步:引入项目下面生成的 fontclass 代码:

<link rel="stylesheet" href="./iconfont.css">

第二步:挑选相应图标并获取类名,应用于页面:

<span class="iconfont icon-xxx"></span>

" iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

  • 单选-fill
    #icon-radio-filled
  • 单选
    #icon-radio-disabled
  • 方形未选中
    #icon-checkbox
  • 方形选中-fill
    #icon-checkbox-filled
  • 方形选中
    #icon-checkbox-disabled
  • 加号
    #icon-jiahao2
  • 加号1
    #icon-jiahao
  • 加号2-fill
    #icon-jiahao2-filled
  • 减号
    #icon-jianhao
  • 圆形未选中
    #icon-radio
  • 更多
    #icon-gengduo
  • 首页-fill
    #icon-home-filled
  • 首页
    #icon-home
  • Android更多
    #icon-gengduo2
  • pull_down
    #icon-pulldown
  • frown
    #icon-frown
  • meh
    #icon-meh
  • smile
    #icon-smile
  • add user
    #icon-adduser
  • delete team
    #icon-deleteteam
  • delete user
    #icon-deleteuser
  • addteam
    #icon-addteam
  • user
    #icon-user
  • team
    #icon-team
  • frown-fill
    #icon-frown-filled
  • meh-fill
    #icon-meh-filled
  • smile-fill
    #icon-smile-filled
  • delete
    #icon-delete
  • close
    #icon-close-simple
  • view
    #icon-view
  • view_off
    #icon-view-off
  • message
    #icon-message
  • time
    #icon-time
  • cart_empty
    #icon-cart-empty
  • cart
    #icon-cart
  • search
    #icon-search
  • edit
    #icon-edit
  • link
    #icon-link
  • share
    #icon-share
  • setting
    #icon-setting
  • upload
    #icon-upload
  • download
    #icon-download
  • play
    #icon-play
  • region
    #icon-region
  • phonecall
    #icon-phonecall
  • lock
    #icon-lock
  • unlock
    #icon-unlock
  • image
    #icon-image
  • list
    #icon-list
  • refresh
    #icon-refresh
  • close_filled
    #icon-close-filled
  • check
    #icon-check
  • close
    #icon-close
  • check_filled
    #icon-check-filled
  • forbidden
    #icon-forbidden
  • forbidden_filled
    #icon-forbidden-filled
  • info_filled
    #icon-info-filled
  • info
    #icon-info
  • help_filled
    #icon-help-filled
  • help
    #icon-help
  • caution
    #icon-caution
  • caution_filled
    #icon-caution-filled
  • like
    #icon-like
  • like_filled
    #icon-like-filled
  • star
    #icon-star
  • star_filled
    #icon-star-filled
  • arrow_up
    #icon-arrow-up
  • arrow_left
    #icon-arrow-left
  • arrow_down
    #icon-arrow-down
  • arrow_right
    #icon-arrow-right
  • page_first
    #icon-page-first
  • down_to_bottom
    #icon-down-to-bottom
  • up_to_top
    #icon-up-to-top
  • page_last
    #icon-page-last
  • page_turning_left
    #icon-page-turn-left
  • page_turning_right
    #icon-page-turn-right
  • show_less
    #icon-show-less
  • show_more
    #icon-show-more
  • social_sina
    #icon-social-sina
  • social_google
    #icon-social-google
  • social_github
    #icon-social-github
  • social_wechat
    #icon-social-wechat
  • go-to-link
    #icon-go-to-link
  • benefits
    #icon-benefits
  • alipay
    #icon-alipay
  • taobao
    #icon-taobao
  • mute mode
    #icon-volume-off
  • volume
    #icon-volume
  • info
    #icon-info-down
  • info_filled
    #icon-info-down-filled
  • pull_down
    #icon-pullup

Symbol 引用


这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇文章 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:

  • 支持多色图标了,不再受单色限制。
  • 通过一些技巧,支持像字体那样,通过 font-size, color 来调整样式。
  • 兼容性较差,支持 IE9+,及现代浏览器。
  • 浏览器渲染 SVG 的性能一般,还不如 png。

使用步骤如下:

第一步:引入项目下面生成的 symbol 代码:

<script src="./iconfont.js"></script>

第二步:加入通用 CSS 代码(引入一次就行):

<style>
.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>

第三步:挑选相应图标并获取类名,应用于页面:

<svg class="icon" aria-hidden="true">
  <use xlink:href="#icon-xxx"></use>
</svg>