@/utils/utils#isUrl JavaScript Examples
The following examples show how to use
@/utils/utils#isUrl.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BaseMenu.js From acy-dex-interface with MIT License | 6 votes |
getIcon = icon => {
if (typeof icon === 'string' && isUrl(icon)) {
return <img src={icon} alt="icon" className={styles.icon} />;
}
if (typeof icon === 'string') {
return <Icon type={icon} />;
}
return icon;
}
Example #2
Source File: BaseMenu.js From online-test-platform with Apache License 2.0 | 6 votes |
getIcon = icon => {
if (typeof icon === 'string') {
if (isUrl(icon)) {
return <Icon component={() => <img src={icon} alt="icon" className={styles.icon} />} />;
}
if (icon.startsWith('icon-')) {
return <IconFont type={icon} />;
}
return <Icon type={icon} />;
}
return icon;
}
Example #3
Source File: BaseMenu.js From youdidao-unmanned-shop with MIT License | 6 votes |
getIcon = icon => {
if (typeof icon === 'string') {
if (isUrl(icon)) {
return <Icon component={() => <img src={icon} alt="icon" className={styles.icon} />} />;
}
if (icon.startsWith('icon-')) {
return <IconFont type={icon} />;
}
return <Icon type={icon} />;
}
return icon;
}