Socket
Book a DemoInstallSign in
Socket

@dsyx/text-avatar

Package Overview
Dependencies
Maintainers
4
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dsyx/text-avatar

文字头像组件

latest
npmnpm
Version
1.0.1
Version published
Maintainers
4
Created
Source

文字头像组件

安装

npm i @dsyx/text-avatar --save

使用

import React from 'react';
import { message } from 'antd';
import TextAvatar from '@dsyx/text-avatar';

export default props => {
	const user = {
	    id: 10,
		account: 'xiaoming',
		empStatus: 1,
		nickname: '王小明'	 
	};

	const cardConfig = [
		{
			label: '部门',
			value: '企业技术部-PaaS-UED'
		},
		{
			label: '邮箱',
			value: 'xiaoming@qq.com'
		}
	];

	return (
		<TextAvatar
			{...user}
			cardConfig={cardConfig}
			onClick={() => {
				message.info('跳转链接');
			}}
		/>
	);
};

API

组件API

参数数据类型是否必填默认值备注
nicknameString-用户昵称
accountString-用户账号,用来判断使用颜色
empStatusnumber1用户状态,1是正常状态,2则为灰色
showPopoverbooleantrue是否显示popover浮层
sizenumber32头像大小(宽高)
linearGradientbooleanfalse是否渐变
randomColorbooleantrue是否随机颜色,如果不随机,则为固定蓝色
onClickfunction-卡片内的头像点击
themeStringdefault卡片内的主题,default、plant
sameAsChildrenbooleantrue卡片内的头像是否和children一样

浮层相关API

参数数据类型是否必填默认值备注
triggerStringhover浮层详情显示方式,同Popover
placementStringrightTop浮层详情显示位置,同Popover
cardConfigArray[]卡片内的详情配置
onClickfunction-卡片内的头像点击

Keywords

avatar

FAQs

Package last updated on 19 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts