rax-icon
icon component for Rax.
Last updated 3 years ago by rax-publisher .
BSD-3-Clause · Repository · Bugs · Original npm · Tarball · package.json
$ npm install rax-icon 
SYNC missed versions from official npm registry.

rax-icon

npm

支持

Web / Weex / 阿里小程序 / 微信小程序

描述

图标组件,实现了 W3C 标准的 IconFont 接口。

安装

$ npm install rax-icon --save

属性

  1. 小程序存在两种构建模式:编译时和运行时。如无说明,该属性支持小程序即指两种构建模式均支持
  2. 如果没有传入 fontFamily 和 codePoint,但传入了 source.uri,则 source.uri 会被认为是图片型 icon 的 url,否则 source.uri 会被认为是 iconfont 的 url。
属性 类型 默认值 必填 描述 支持
source.uri String - 图片型icon的url或iconfont的url browserweex miniApp wechatMiniprogram quickApp
fontFamily String - iconfont的字体 browser weex miniApp wechatMiniprogram quickApp
source.codePoint String - iconfont的码点 browserweex miniApp wechatMiniprogram quickApp

方法

IconComponent createIconSet(Object map, String name, String url);

支持

browserweexminiAppwechatMiniprogram (小程序编译时模式不支持)

参数

属性 类型 默认值 必填 描述
map Object - 描述字符集映射,eg:{ hello: '\ue60f' }
name String - 字体名称
url String - 字体文件的 URL

返回

属性 类型 默认值 必填 描述
name String - 字符的名称
codePoint String - iconfont 的码点

示例

import { createElement, render, Component } from 'rax';
import DriverUniversal from 'driver-universal';
import View from 'rax-view';
import Icon, { createIconSet } from '../src/index';

const IconFont1 = createIconSet({}, 'iconfont', 'https://at.alicdn.com/t/font_pkm0oq8is8fo5hfr.ttf');
const IconFont2 = createIconSet({
  hello: '\uE60f'
}, 'iconfont', 'https://at.alicdn.com/t/font_pkm0oq8is8fo5hfr.ttf');
const icon = 'https://gw.alicdn.com/tfs/TB1KRRuQXXXXXbwapXXXXXXXXXX-200-200.png';

class Demo extends Component {
  render() {
    return (
      <View>
        <Icon source={{uri: icon}}/>
        <Icon fontFamily="iconfont" source={{uri: 'https://at.alicdn.com/t/font_pkm0oq8is8fo5hfr.ttf', codePoint: '\uE60f'}}/>
        <IconFont1 codePoint={'\uE60f'}/>
        <IconFont2 name={'hello'}/>
      </View>
    );
  }
}

render(<Demo />, document.body, { driver: DriverUniversal });

Current Tags

  • 1.4.5-beta.2                                ...           beta (3 years ago)
  • 1.4.5                                ...           latest (3 years ago)

90 Versions

  • 1.4.5                                ...           3 years ago
  • 1.4.5-beta.2                                ...           3 years ago
  • 1.4.5-beta.1                                ...           3 years ago
  • 1.4.4                                ...           3 years ago
  • 1.4.4-beta.1                                ...           3 years ago
  • 1.4.3                                ...           3 years ago
  • 1.4.3-0                                ...           3 years ago
  • 1.4.2                                ...           3 years ago
  • 1.4.1                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.8                                ...           4 years ago
  • 1.3.8-0                                ...           4 years ago
  • 1.3.7                                ...           4 years ago
  • 1.3.6                                ...           4 years ago
  • 1.3.5                                ...           4 years ago
  • 1.3.4                                ...           4 years ago
  • 1.3.4-beta.0                                ...           4 years ago
  • 1.3.3                                ...           4 years ago
  • 1.3.3-0                                ...           4 years ago
  • 1.3.2                                ...           4 years ago
  • 1.3.2-2                                ...           5 years ago
  • 1.3.1                                ...           5 years ago
  • 1.3.1-beta.2                                ...           5 years ago
  • 1.3.1-beta.1                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.1-0                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.1.0-6                                ...           5 years ago
  • 1.1.0-5                                ...           5 years ago
  • 1.1.0-4                                ...           5 years ago
  • 1.1.0-3                                ...           5 years ago
  • 1.1.0-2                                ...           5 years ago
  • 1.1.0-1                                ...           5 years ago
  • 1.1.0-0                                ...           5 years ago
  • 1.0.1-beta.2                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 1.0.0-beta.0                                ...           5 years ago
  • 0.6.5                                ...           6 years ago
  • 0.6.4                                ...           6 years ago
  • 0.6.3                                ...           7 years ago
  • 0.6.2                                ...           7 years ago
  • 0.6.0                                ...           7 years ago
  • 0.5.4                                ...           7 years ago
  • 0.5.2                                ...           7 years ago
  • 0.5.1                                ...           7 years ago
  • 0.5.0                                ...           7 years ago
  • 0.4.20                                ...           7 years ago
  • 0.4.19                                ...           7 years ago
  • 0.4.18                                ...           7 years ago
  • 0.4.17                                ...           7 years ago
  • 0.4.16                                ...           7 years ago
  • 0.4.15                                ...           7 years ago
  • 0.5.0-beta                                ...           7 years ago
  • 0.4.14                                ...           7 years ago
  • 0.4.13                                ...           7 years ago
  • 0.4.12                                ...           7 years ago
  • 0.4.11                                ...           7 years ago
  • 0.4.10                                ...           7 years ago
  • 0.4.9                                ...           7 years ago
  • 0.4.8                                ...           7 years ago
  • 0.4.7                                ...           7 years ago
  • 0.4.6                                ...           7 years ago
  • 0.4.5                                ...           7 years ago
  • 0.4.4                                ...           7 years ago
  • 0.4.3                                ...           7 years ago
  • 0.4.2                                ...           7 years ago
  • 0.4.1                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
  • 0.3.8                                ...           7 years ago
  • 0.3.7                                ...           7 years ago
  • 0.3.6                                ...           7 years ago
  • 0.3.5                                ...           7 years ago
  • 0.3.4                                ...           7 years ago
  • 0.3.3                                ...           8 years ago
  • 0.3.2                                ...           8 years ago
  • 0.3.1                                ...           8 years ago
  • 0.3.0                                ...           8 years ago
  • 0.2.11                                ...           8 years ago
  • 0.2.10                                ...           8 years ago
  • 0.2.9                                ...           8 years ago
  • 0.2.8                                ...           8 years ago
  • 0.2.7                                ...           8 years ago
  • 0.2.6                                ...           8 years ago
  • 0.2.5                                ...           8 years ago
  • 0.2.4                                ...           8 years ago
  • 0.2.3                                ...           8 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (13)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE