Files
Aether/frontend/src/components/ui/avatar-image.vue
fawney19 c2eaa9181a refactor(frontend): 优化 UI 基础组件
- 添加默认 class 属性支持
- 改进组件类型定义
- 优化属性配置
2025-12-14 00:16:02 +08:00

30 lines
532 B
Vue

<script setup lang="ts">
import { AvatarImage as AvatarImagePrimitive } from 'radix-vue'
import { cn } from '@/lib/utils'
import { computed } from 'vue'
interface Props {
class?: string
src?: string
alt: string
}
const props = withDefaults(defineProps<Props>(), {
class: undefined,
src: undefined,
alt: ''
})
const imageClass = computed(() =>
cn('aspect-square h-full w-full', props.class)
)
</script>
<template>
<AvatarImagePrimitive
:class="imageClass"
:src="src || ''"
:alt="alt"
/>
</template>