数据结构优化

This commit is contained in:
李琦
2026-01-20 19:59:50 +08:00
parent cf8b89f731
commit ec4f5a9856
6 changed files with 216 additions and 105 deletions

View File

@@ -3,7 +3,7 @@
:is="iconComponent"
:class="className"
:style="style"
:size="size"
:size="iconSize"
/>
</template>
@@ -35,4 +35,13 @@ const iconComponent = computed(() => {
const iconName = toPascalCase(props.name) as keyof typeof LucideIcons
return LucideIcons[iconName] || LucideIcons.AlertCircle
})
// 确保 size 是 number 类型
const iconSize = computed(() => {
if (typeof props.size === 'string') {
const parsed = parseInt(props.size, 10)
return isNaN(parsed) ? 24 : parsed
}
return props.size ?? 24
})
</script>