34 lines
1.2 KiB
TypeScript
34 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
|
|
/**
|
|
* 渲染一个 iconfont symbol 图标(依赖 Iconfont.init 注入的 SVG symbol 脚本)
|
|
* @param {Object} props
|
|
* @param {string} [props.className] 额外的 class 名
|
|
* @param {string} props.type 图标名,对应 svg symbol 的 id
|
|
* @param {Object} [props.style] 行内样式
|
|
*/
|
|
declare function Iconfont({ className, type, style, ...props }: {
|
|
className?: string;
|
|
type: string;
|
|
style?: any;
|
|
}): React.JSX.Element;
|
|
declare namespace Iconfont {
|
|
export namespace propTypes {
|
|
let className: PropTypes.Requireable<string>;
|
|
let type: PropTypes.Validator<string>;
|
|
let style: PropTypes.Requireable<object>;
|
|
}
|
|
export { createScriptUrlElements as init };
|
|
}
|
|
|
|
/**
|
|
* 依次注入 iconfont symbol 的 script 地址(单个 url 只会注入一次);
|
|
* 也是 Iconfont.init 挂载的实现,支持传入多个 url 按顺序加载(前一个 load/error 后再加载下一个)
|
|
* @param {string[]} [scriptUrls] iconfont symbol 脚本地址列表
|
|
* @param {number} [index] 内部递归用的当前下标
|
|
*/
|
|
declare function createScriptUrlElements(scriptUrls?: string[], index?: number): void;
|
|
|
|
export { Iconfont as default };
|