rs-avatar

1.0.10 • Public • Published

cr-avatar

A react component about custom avatar

view

HoverHoc

Installation

npm install --save cr-avatar

Usage

import React, { PureComponent } from 'react';
import Avatar from 'cr-avatar';
import 'cr-avatar/assets/index.css';

class App extends PureComponent {

  handleRemove = () => {
    console.log('删除回调')
  }

  render() {
    return (
      <Avatar
        name='刘亦菲'
        color='#647BFC'
        mode='line'
        onRemove={this.handleRemove}       
      />
    )
  }
}

API

name type description
name string 名称
color string 颜色
mode string 组件模式(行内模式: 'line'; 头像模式: 'head')
url string 头像URL
onRemove function 点击删除回调
remove bool 可删除按钮配置(true: 有删除按钮, false: 没有删除按钮),默认值为true

Development

git clone https://github.com/Fea-Sin/cr-avatar.git

cnpm install

npm start

Example

http://localhost:8018/examples/testOne.html

Test

npm test

npm run coverage

License

cr-comp is released under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i rs-avatar

Weekly Downloads

0

Version

1.0.10

License

MIT

Unpacked Size

64.5 kB

Total Files

15

Last publish

Collaborators

  • sunyufen