diff --git a/components/icon/IconFont.tsx b/components/icon/IconFont.tsx index 6e95b49df3..db5542b86d 100644 --- a/components/icon/IconFont.tsx +++ b/components/icon/IconFont.tsx @@ -4,14 +4,12 @@ import * as React from 'react'; const customCache = new Set(); export interface CustomIconOptions { - namespace?: string; - prefix?: string; scriptUrl?: string; extraCommonProps?: { [key: string]: any }; } export default function create(options: CustomIconOptions = {}): React.SFC { - const { namespace, prefix = '', scriptUrl, extraCommonProps = {} } = options; + const { scriptUrl, extraCommonProps = {} } = options; /** * DOM API required. @@ -22,13 +20,12 @@ export default function create(options: CustomIconOptions = {}): React.SFC children > type let content = null; if (props.type) { - content = ; + content = ; } if (props.children) { content = props.children; diff --git a/components/icon/__tests__/index.test.js b/components/icon/__tests__/index.test.js index a471e446e6..e964648acf 100644 --- a/components/icon/__tests__/index.test.js +++ b/components/icon/__tests__/index.test.js @@ -90,17 +90,15 @@ describe('Icon', () => { describe('Icon.createFromIconfontCN()', () => { const IconFont = Icon.createFromIconfontCN({ - namespace: 'iconfont-foo', scriptUrl: '//at.alicdn.com/t/font_8d5l8fzk5b87iudi.js', - prefix: 'icon-', }); it('should support iconfont.cn', () => { const wrapper = render(
- - - + + +
); expect(wrapper).toMatchSnapshot(); diff --git a/components/icon/demo/iconfont.md b/components/icon/demo/iconfont.md index a86b244443..d072897265 100644 --- a/components/icon/demo/iconfont.md +++ b/components/icon/demo/iconfont.md @@ -17,16 +17,14 @@ If you are using [iconfont.cn](http://iconfont.cn/), you can use the icons in yo import { Icon } from 'antd'; const IconFont = Icon.createFromIconfontCN({ - namespace: 'iconfont-foo', scriptUrl: '//at.alicdn.com/t/font_8d5l8fzk5b87iudi.js', - prefix: 'icon-', }); ReactDOM.render(
- - - + + +
, mountNode ); diff --git a/components/icon/index.en-US.md b/components/icon/index.en-US.md index 91e9a2a728..f84cbe0f04 100644 --- a/components/icon/index.en-US.md +++ b/components/icon/index.en-US.md @@ -134,10 +134,8 @@ The following options are available: | Property | Description | Type | Default | | --- | --- | --- | --- | -| prefix | The prefix of the icon set. It ends with `-` generally, like `icon-`、`foo-` | string | '' | -| extraCommonProps | Define extra properties to the component | `{ [key: string]: any }` | {} | -| namespace | The namespace of the icon set, used as identifier. | string | - | | scriptUrl | The URL generated by [iconfont.cn](http://iconfont.cn/) project. | string | - | +| extraCommonProps | Define extra properties to the component | `{ [key: string]: any }` | {} | The property `scriptUrl` should be set together with property `namespace`. diff --git a/components/icon/index.zh-CN.md b/components/icon/index.zh-CN.md index fff5f99c3f..e338b1fcc2 100644 --- a/components/icon/index.zh-CN.md +++ b/components/icon/index.zh-CN.md @@ -134,10 +134,8 @@ ReactDOM.render(, mountedNode); | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | -| prefix | 设置图标的前缀,通常以短横线结尾,如 `icon-`、`foo-` | string | '' | -| extraCommonProps | 给所有的 `svg` 图标 `` 组件设置额外的属性 | `{ [key: string]: any }` | {} | -| namespace | 图标集合的名字空间,在 `scriptUrl` 也设置的情况下有效,用于区分已导入的图标符号集合 | string | - | | scriptUrl | [iconfont.cn](http://iconfont.cn/) 项目在线生成的 `js` 地址,在 `namespace` 也设置的情况下有效 | string | - | +| extraCommonProps | 给所有的 `svg` 图标 `` 组件设置额外的属性 | `{ [key: string]: any }` | {} | 在 `namespace` 和 `scriptUrl` 都设置有效的情况下,组件在渲染前会自动引入 [iconfont.cn](http://iconfont.cn/) 项目中的图标符号集,无需手动引入。