Skip to content

Icon 图标

移动端图标组件,基于内置 iconfont 图标类名渲染,支持尺寸、颜色和旋转角度。

示例

基础用法

通过 name 传入内置 iconfont 图标类名,使用 sizecolor 设置尺寸与颜色,rotate 设置旋转角度。

API

Props

参数类型默认值说明
namestring-图标类名,必须是内置 iconfont 中存在的类名
sizenumber | string'inherit'图标大小。数字会按 px 处理,也可传入 'inherit'
colorstring'inherit'图标颜色
rotatenumber0图标旋转角度,单位为 deg

注意事项

  1. name 需要传入组件库内置 iconfont 中存在的图标类名。
  2. sizecolor 默认继承父级样式,适合跟随文本或按钮内容变化。
  3. rotate 会通过 CSS transform 应用旋转角度。