/**
* Icon 自定义组件,提供定制Icon组件能力
*
*
*/
import * as React from "react";
import { createFromIconfontCN } from "@ant-design/icons";
import { Util } from "@/utils";
export declare type IconType = React.ReactNode | string;
const hrmSalaryUrl = "/spa/hrmSalary/hrmSalaryCalculateDetail/";
const Icon = createFromIconfontCN({
scriptUrl: [
// @ts-ignore
`${process.env.NODE_ENV === "dev" ? Util.getPublicPath() : hrmSalaryUrl}css/iconfont/iconfont.js`
]
});
/**
* 根据参数构建图标
* @param icon
*/
export const buildIcon: (
type: string,
icon: IconType,
style?: React.CSSProperties,
className?: string
) => React.ReactNode | null = function (
type,
icon,
style = {},
className = ""
) {
let comp;
switch (type) {
case "IMAGE":
comp =
typeof icon === "string" ? (
) : (
icon
);
break;
default:
comp =
typeof icon === "string" ? (
) : (
icon
);
}
return comp;
};
export default Icon;