refactor(frontend): 优化 UI 基础组件

- 添加默认 class 属性支持
- 改进组件类型定义
- 优化属性配置
This commit is contained in:
fawney19
2025-12-12 20:21:50 +08:00
parent ca60202636
commit c2eaa9181a
7 changed files with 12 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ interface Props {
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
class: undefined,
src: undefined,
alt: '' alt: ''
}) })

View File

@@ -5,6 +5,7 @@ import { computed } from 'vue'
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
variant: 'default', variant: 'default',
class: undefined,
}) })
const badgeVariants = cva( const badgeVariants = cva(

View File

@@ -25,6 +25,7 @@ const props = withDefaults(defineProps<Props>(), {
variant: 'default', variant: 'default',
size: 'default', size: 'default',
disabled: false, disabled: false,
class: undefined,
type: 'button' type: 'button'
}) })

View File

@@ -14,7 +14,8 @@ interface Props {
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
variant: 'default' variant: 'default',
class: undefined,
}) })
// 标准卡片变体定义 // 标准卡片变体定义

View File

@@ -35,8 +35,12 @@ interface Props {
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
class: undefined,
position: 'popper', position: 'popper',
side: undefined,
sideOffset: 4, sideOffset: 4,
align: undefined,
alignOffset: undefined,
}) })
const contentClass = computed(() => const contentClass = computed(() =>

View File

@@ -5,7 +5,7 @@ interface Props {
placeholder?: string placeholder?: string
} }
const props = defineProps<Props>() defineProps<Props>()
</script> </script>
<template> <template>

View File

@@ -10,6 +10,7 @@ interface Props {
} }
const props = withDefaults(defineProps<Props>(), { const props = withDefaults(defineProps<Props>(), {
class: undefined,
orientation: 'horizontal', orientation: 'horizontal',
decorative: true, decorative: true,
}) })