chore: 优化代码
This commit is contained in:
parent
a60ff01c3a
commit
160d4a0a82
@ -213,12 +213,8 @@ export function renderOsIcon(os: string, center = false) {
|
||||
if (os.toLocaleLowerCase().includes('windows')) {
|
||||
current = osOptions[0];
|
||||
}
|
||||
if (current) {
|
||||
return renderIconSpan(current.icon, os, center, '5px');
|
||||
}
|
||||
// 返回默认
|
||||
const defaultIcon = DefaultOsIcon;
|
||||
return renderIconSpan(defaultIcon, os, center, '5px');
|
||||
const icon = current ? current.icon : DefaultOsIcon;
|
||||
return renderIconSpan(icon, os, center, '5px');
|
||||
}
|
||||
|
||||
export function renderBrowserIcon(browser: string, center = false) {
|
||||
@ -228,10 +224,6 @@ export function renderBrowserIcon(browser: string, center = false) {
|
||||
const current = browserOptions.find((item) =>
|
||||
browser.toLocaleLowerCase().includes(item.value),
|
||||
);
|
||||
if (current) {
|
||||
return renderIconSpan(current.icon, browser, center, '5px');
|
||||
}
|
||||
// 返回默认
|
||||
const defaultIcon = DefaultBrowserIcon;
|
||||
return renderIconSpan(defaultIcon, browser, center, '5px');
|
||||
const icon = current ? current.icon : DefaultBrowserIcon;
|
||||
return renderIconSpan(icon, browser, center, '5px');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user