Appearance
Avatar 头像
用于展示用户头像,支持图片、文字、图标三种内容,以及头像组。
基础用法
U
尺寸
SML56
形状
圆方AB
头像组
ABC+2
API
AAvatar Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
src | string | — | 图片地址 |
alt | string | '' | 图片 alt 文字 |
shape | AvatarShape | 'circle' | 形状:circle | square |
size | AvatarSize | 'md' | 尺寸:sm | md | lg | number |
color | string | — | 字体颜色 |
background | string | — | 背景色 |
gap | number | 4 | 文字缩放时的边距(px) |
className | string | — | 自定义 class |
style | object | — | 自定义样式 |
AAvatar Slots
| 插槽 | 说明 |
|---|---|
default | 文字内容(自动缩放) |
icon | 自定义图标(无 src 时) |
AAvatarGroup Props
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
max | number | — | 最多显示数量,超出则显示 +N |
size | AvatarSize | — | 统一设置子 Avatar 尺寸 |
shape | AvatarShape | — | 统一设置子 Avatar 形状 |
className | string | — | 自定义 class |
style | object | — | 自定义样式 |
类型
ts
type AvatarShape = "circle" | "square";
type AvatarSize = "sm" | "md" | "lg" | number;