fix Icon.createFromIconfontCN usage

This commit is contained in:
HeskeyBaozi 2018-09-03 11:41:29 +08:00 committed by 偏右
parent 1ecd2b4150
commit 633d73b21a
2 changed files with 3 additions and 7 deletions

View File

@ -98,12 +98,10 @@ This method is specified for [iconfont.cn](http://iconfont.cn/).
```js
const MyIcon = Icon.createFromIconfontCN({
namespace: 'foo', // identifier
scriptUrl: 'at.alicdn.com/t/font_8d5l8fzk5b87iudi', // generated by iconfont.cn
prefix: 'icon-',
scriptUrl: '//at.alicdn.com/t/font_8d5l8fzk5b87iudi.js', // generated by iconfont.cn
});
ReactDOM.render(<MyIcon type="example" />, mountedNode);
ReactDOM.render(<MyIcon type="icon-example" />, mountedNode);
```
It create a component that uses SVG sprites in essence.

View File

@ -102,12 +102,10 @@ ReactDOM.render(
```js
const MyIcon = Icon.createFromIconfontCN({
namespace: 'foo', // identifier
scriptUrl: '//at.alicdn.com/t/font_8d5l8fzk5b87iudi.js', // generated by iconfont.cn
prefix: 'icon-',
});
ReactDOM.render(<MyIcon type="example" />, mountedNode);
ReactDOM.render(<MyIcon type="icon-example" />, mountedNode);
```
其本质上是创建了一个使用 `<use>` 标签来渲染图标的组件。