taro-iconfont-generator
v1.0.4
Published
Taro SVG iconfont component generator - 让Taro也能使用阿里矢量图标库的SVG
Maintainers
Readme
taro-iconfont-generator
Taro3.x SVG iconfont 组件生成器,支持本地SVG、阿里iconfont、阴影自定义等。
安装
npm install taro-iconfont-generator -D
# 或
pnpm install taro-iconfont-generator -D快速使用
- 初始化配置
npx iconfont-init- 生成组件
npx iconfont-taro- 在项目中引入并使用
import IconFont from '你的生成目录/iconfont';
<IconFont name="fuwuzixun" size={80} />
<IconFont name="fuwuzixun" size={80} shadow="#5EB7F588" />
<IconFont name="fuwuzixun" size={80} shadow="0 2px 8px #0003" />Props
| 属性 | 类型 | 说明 | |----------------|---------------------|----------------------------| | name | string | 图标名称(自动类型提示) | | size | number | 图标尺寸(px) | | color | string | string[] | 图标颜色,支持多色 | | customStyle | React.CSSProperties | 自定义行内样式 | | customClassName| string | 自定义类名 | | shadow | string | 阴影,支持颜色或完整box-shadow |
亮点功能
- 支持本地SVG和阿里iconfont混合生成
- 支持自定义阴影(shadow)
- 支持自定义样式、hover等扩展
- 生成的组件类型安全、易用
更多高级用法和配置,请参考源码或 issue。
