Commit 74dffef9 authored by zhuyangbin's avatar zhuyangbin

update

parent 07c6cb0e
import { Icon } from 'antd';
const IconFont = Icon.createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_1509781_pkjtz0jd3g.js',
});
export default IconFont;
import { createFromIconfontCN } from '@ant-design/icons';
const IconFont = createFromIconfontCN({
scriptUrl: '//at.alicdn.com/t/font_1509781_7snuvbtppnq.js',
});
export default IconFont;
import React from 'react';
import { Icon } from 'antd';
import IconFont from './IconFont';
import styles from './styles.less';
const CustomIcon = props => {
const { type, iconFontType } = props;
const isHttp = /^((https|http)?:\/\/)[^\s]+/.test(type);
if (iconFontType) {
return <IconFont type={iconFontType} />
}
return isHttp ? <img src={type} alt="icon" className={`${styles.iconCls}`} /> : <Icon type={type} />
};
export default CustomIcon
\ No newline at end of file
import React from 'react';
import IconFont from './IconFont';
import styles from './styles.less';
interface IProps {
type?: string;
src?: string;
}
const CustomIcon = (props:IProps) => {
const { type, src } = props;
const isHttp = /^((https|http)?:\/\/)[^\s]+/.test(src || '');
if (type) {
return <IconFont type={type} />;
} if (src && isHttp) {
return <img src={src} alt="icon" className={`${styles.iconCls}`} />;
}
return null;
};
export default CustomIcon;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment