chore: 优化代码

This commit is contained in:
dap 2025-01-08 15:47:25 +08:00
parent a60ff01c3a
commit 160d4a0a82

View File

@ -213,12 +213,8 @@ export function renderOsIcon(os: string, center = false) {
if (os.toLocaleLowerCase().includes('windows')) { if (os.toLocaleLowerCase().includes('windows')) {
current = osOptions[0]; current = osOptions[0];
} }
if (current) { const icon = current ? current.icon : DefaultOsIcon;
return renderIconSpan(current.icon, os, center, '5px'); return renderIconSpan(icon, os, center, '5px');
}
// 返回默认
const defaultIcon = DefaultOsIcon;
return renderIconSpan(defaultIcon, os, center, '5px');
} }
export function renderBrowserIcon(browser: string, center = false) { export function renderBrowserIcon(browser: string, center = false) {
@ -228,10 +224,6 @@ export function renderBrowserIcon(browser: string, center = false) {
const current = browserOptions.find((item) => const current = browserOptions.find((item) =>
browser.toLocaleLowerCase().includes(item.value), browser.toLocaleLowerCase().includes(item.value),
); );
if (current) { const icon = current ? current.icon : DefaultBrowserIcon;
return renderIconSpan(current.icon, browser, center, '5px'); return renderIconSpan(icon, browser, center, '5px');
}
// 返回默认
const defaultIcon = DefaultBrowserIcon;
return renderIconSpan(defaultIcon, browser, center, '5px');
} }