头像文字或源为空文本时fallback

This commit is contained in:
CrescentLeaf
2025-12-07 00:30:45 +08:00
parent bd49edb586
commit 07bc4a6654

View File

@@ -12,9 +12,9 @@ export default function Avatar({
avatarRef,
...props
}: Args) {
if (src != null)
if (src != null && src != '')
return <mdui-avatar ref={avatarRef} {...props} src={src} />
else if (text != null)
else if (text != null && text != '')
return <mdui-avatar ref={avatarRef} {...props}>
{
text.substring(0, 1)