diff --git a/components/icon/IconFont.jsx b/components/icon/IconFont.jsx index 751d9f6a6..1d483ae4a 100644 --- a/components/icon/IconFont.jsx +++ b/components/icon/IconFont.jsx @@ -1,9 +1,10 @@ import Icon from './index'; +import { mergeProps } from '../_util/props-util'; const customCache = new Set(); export default function create(options) { - const { scriptUrl } = options; + const { scriptUrl, extraCommonProps = {} } = options; /** * DOM API required. @@ -43,7 +44,8 @@ export default function create(options) { if (children) { content = children; } - return {content}; + const iconProps = mergeProps(extraCommonProps, data, { props: restProps, on: listeners }); + return {content}; }, }; return Iconfont; diff --git a/components/icon/index.en-US.md b/components/icon/index.en-US.md index 057dea421..39020607a 100644 --- a/components/icon/index.en-US.md +++ b/components/icon/index.en-US.md @@ -72,7 +72,7 @@ The following options are available: | Property | Description | Type | Default | | --- | --- | --- | --- | | scriptUrl | The URL generated by [iconfont.cn](http://iconfont.cn/) project. | string | - | -| extraCommonProps | Define extra properties to the component | `{ [key: string]: any }` | {} | +| extraCommonProps | Define extra properties to the component | `{ class, attrs, props, on, style }` | {} | The property `scriptUrl` should be set to import the SVG sprite symbols. diff --git a/components/icon/index.zh-CN.md b/components/icon/index.zh-CN.md index 538b39e86..36e39cf50 100644 --- a/components/icon/index.zh-CN.md +++ b/components/icon/index.zh-CN.md @@ -70,7 +70,7 @@ new Vue({ | 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | scriptUrl | [iconfont.cn](http://iconfont.cn/) 项目在线生成的 `js` 地址 | string | - | -| extraCommonProps | 给所有的 `svg` 图标 `` 组件设置额外的属性 | `{ [key: string]: any }` | {} | +| extraCommonProps | 给所有的 `svg` 图标 `` 组件设置额外的属性 | `{ class, attrs, props, on, style }` | {} | 在 `scriptUrl` 都设置有效的情况下,组件在渲染前会自动引入 [iconfont.cn](http://iconfont.cn/) 项目中的图标符号集,无需手动引入。