@nutui/nutui-react
Version:
京东风格的轻量级移动端 React 组件库,支持一套代码生成 H5 和小程序
60 lines (59 loc) • 1.44 kB
TypeScript
import { default as React, FunctionComponent, MouseEvent } from 'react';
import { BasicComponent } from '../../utils/typings';
import { default as AvatarGroup } from '../avatargroup';
export interface AvatarProps extends BasicComponent {
/**
* 设置头像的大小
* @default -
*/
size: string
/**
* 设置 Icon 类型头像图标
* @default -
*/
icon: React.ReactNode
/**
* 图片填充模式
* @default -
*/
fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down'
/**
* 设置头像的形状
* @default round
*/
shape: AvatarShape
/**
* 设置 Icon、字符类型头像的背景色
* @default #eee
*/
background: string
/**
* 设置 Icon、字符类型头像的颜色
* @default #666
*/
color: string
/**
* 设置图片类型头像的地址
* @default -
*/
src: string
/**
* 设置图片类型头像无法显示时的替代文本
* @default -
*/
alt: string
/**
* 点击头像触发事件
* @default -
*/
onClick: (e: MouseEvent<HTMLDivElement>) => void
/**
* 图片加载失败的事件
* @default -
*/
onError: () => void
}
export type AvatarShape = 'round' | 'square';
export declare const Avatar: FunctionComponent<Partial<AvatarProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>> & {
Group: typeof AvatarGroup;
};