20260810172235

This commit is contained in:
oneao committed 2026-08-10 17:22:36 +08:00
1 parent c4891538a7
commit ed5ab3885d
35 files changed
+1314 -653

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import * as LucideIcons from "@lucide/vue"
let iconMap: Record<string, any> | null = null
function loadIcons() {
if (iconMap) return
const map: Record<string, any> = {}
for (const [key, component] of Object.entries(LucideIcons)) {
if (key !== "default" && key !== "createLucideIcon" && typeof key === "string" && key.charAt(0) === key.charAt(0).toUpperCase()) {
map[key] = component
}
}
iconMap = map
}
/** 同步获取图标组件,传入 null/空字符串时返回 null */
export function getIcon(name?: string | null) {
if (!iconMap) loadIcons()
if (!name || !iconMap) return null
return iconMap[name] || null
}