Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuke-iconfont

Package Overview
Dependencies
Maintainers
2
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuke-iconfont

iconfont

  • 2.3.3
  • npm
  • Socket score

Version published
Weekly downloads
29
increased by93.33%
Maintainers
2
Weekly downloads
 
Created
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

Package last updated on 28 Apr 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc