Socket
Socket
Sign inDemoInstall

nuke-iconfont

Package Overview
Dependencies
0
Maintainers
2
Versions
72
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nuke-iconfont

iconfont


Version published
Weekly downloads
32
decreased by-21.95%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

Iconfont

  • category: API
  • chinese: iconfont
  • type: API 能力

设计思路

Iconfont 是与 web iconfont 类似的能力,用于设置 iconfont。

Iconfont 资源可以从 iconfont.cn 等多个平台导出。

本组件目前只支持单色的 ttf 文件,暂不支持 svg 格式。

注意 Weex 容器内,如果 iconfont 资源如果从远程拉取,可能会存在首次渲染无法成功的情况,如果对 icon 展现要求较高,请使用图片,或实现客户端对字体资源预加载 (或客户端预置),以避免出现此问题。

API

Iconfont 方法

Iconfont({
  name: 'your-unique-font-name',
  url: 'https://at.alicdn.com/t/font_1474198576_7440977.ttf'
});

// \u 写法,code 需为变量
const code = '\ue60f';
<Text style={{ fontSize: 40, fontFamily: 'your-unique-font-name' }}>{code}</Text>;

// 或者不用任何变量
<Text style={{ fontSize: 40, fontFamily: 'your-unique-font-name' }}>&#xe600;</Text>;
options
  • options.name : iconfont 名称,例如 'iconfont1'
  • options.url : iconfont 路径,当前仅支持 ttfwoff 格式

formatUnicode 方法

const { formatUnicode } = Iconfont;
formatUnicode('&#xe600;'); //\ue600

用于将 unicode 转换为 weex 和 H5 同时能够使用的实体字符格式;

Keywords

FAQs

Last updated on 26 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc