Skip to content

Avatar 头像

用于展示用户头像,支持图片、文字、图标三种内容,以及头像组。

基础用法

U

尺寸

SML56

形状

AB

头像组

ABC+2

API

AAvatar Props

属性类型默认值说明
srcstring图片地址
altstring''图片 alt 文字
shapeAvatarShape'circle'形状:circle | square
sizeAvatarSize'md'尺寸:sm | md | lg | number
colorstring字体颜色
backgroundstring背景色
gapnumber4文字缩放时的边距(px)
classNamestring自定义 class
styleobject自定义样式

AAvatar Slots

插槽说明
default文字内容(自动缩放)
icon自定义图标(无 src 时)

AAvatarGroup Props

属性类型默认值说明
maxnumber最多显示数量,超出则显示 +N
sizeAvatarSize统一设置子 Avatar 尺寸
shapeAvatarShape统一设置子 Avatar 形状
classNamestring自定义 class
styleobject自定义样式

类型

ts
type AvatarShape = "circle" | "square";
type AvatarSize = "sm" | "md" | "lg" | number;

AUI Vue Components — Built with Vue 3 & VitePress