@iota-cn/avatar

Install
752 1
Install
npm install @iota-cn/avatar
Latest Version:0.1.15
Vue:2
Older releases:3
License:MIT
Last Updated:Nov 12, 2020
Links: GitHub  ·  npm
Maintainer: novrain

@iota-cn/avatar

Install

npm install @iota-cn/avatar

Use

Import

import Avatar from '@iota-cn/avatar'
import '@iota-cn/avatar/dist/avatar.css'
Vue.use(Avatar)

AvatarViewer

<template>
    <div id="examples">
        <div class='section'>
            <h3>AvatarViewer</h3>
            <code>
            </code>
            <h4>Example</h4>
            <div class='example'>
                <iota-avatar-viewer showUpload
                    nickname="Hi"
                    :img="vueImg"
                    :radius='51' />
            </div>
        </div>
    </div>
</template>
Props
props: {
        showUpload: Boolean,  // Whether show upload icon
        nickname: {           // the name show when image is missing  
            type: String
        },
        img: String,          // avatar image
        width: {              
            type: Number,
            default: 100
        },
        height: {
            type: Number,
            default: 100
        },
        radius: {
            type: Number,
            default: 4
        },
        color: {               // background color
            type: String,
            default: 'gray'
        },
        userStyle: {           // custome styles
            type: Object,
            default() {
                return undefined
            }
        }
    }

RawAvatar

<template>
    <div id="examples">
        <div class='section'>
            <h3>RawAvatar</h3>
            <code>
            </code>
            <h4>Example</h4>
            <div class='example'>
                <iota-rawavatar :img='vueImg'/>
            </div>
        </div>
    </div>
</template>
Props
    props: {
        uploadImg: Function,   // call back to handle image changed(click then select a new image)
        width: Number,         
        height: Number,
        img: String,           // image to show, you can reset it after the 'uploadImg' handler finished.
        tips: Array,           // tips show to the user.
        disabled: Boolean,     // disable click event
    }

AvatarEditor

<template>
    <div id="examples">
        <div class='section'>
            <h3>AvatarEditor</h3>
            <code>
            </code>
            <h4>Example</h4>
            <div class='example'>
                <div class="example-avatar-editor">
                    <iota-avatar-editor :avatarFile='vueImg' />
                </div>
            </div>
        </div>
    </div>
</template>
Props
    props: {
        title: {                           // Editor title, default: Upload Image
            type: String
        },
        previewHint: {                     // hint of preview, default: Preview
            type: String
        },
        selectImgHint: {                   // hint of select image, default: Select Image
            type: String
        },
        cropHint: {                        // hint of crop, default: Best size 'width'x'height', you can cut it.
            type: String
        },
        onAvatarData: Function,            // call back to process the image content.
        radiusPerc: Number,                // radius percent, default: 100 (%)
        width: Number,                     // width of cut window, default: 100 (px)
        height: Number,                    // height of cut window, default: 100 (px)
        avatarFile: {                      // the image to show
            type: [Object, String, File]
        }
    }

Avatar

<template>
    <div id="examples">
        <div class='section'>
            <h3>AvatarEditor with default Modal</h3>
            <code>
            </code>
            <h4>Example</h4>
            <div class='example'>
                <iota-avatar />
            </div>
        </div>
    </div>
</template>
Props
    props: {
        title: String,          // Editor title, default: Upload Image
        previewHint: String,    // hint of preview, default: Preview
        selectImgHint: String,  // hint of select image, default: Select Image
        cropHint: String,       // hint of crop, default: Best size 'width'x'height', you can cut it.
        onAvatarData: Function, // call back to process the image content.
        width: Number,          // width of cut window, default: 100 (px)
        height: Number,         // height of cut window, default: 100 (px)
        radiusPerc: Number      // radius percent, default: 100 (%)
    }
slot
controller                      // replace default 'Select Image' button, for example, you can use an AvataViewer inside the Avatar

head                            // replace the "default header" in opened modal dialog.

Example

git clone git@github.com:iota-cn/vue-iota-avatar.git

cd vue-iota-avatar
npm i
npm run examples
 DONE  Compiled successfully in 9558ms                                                                                                                                                        13:15:45


  App running at:
  - Local:   http://localhost:8080/
  ...

Related Packages

vue-avatar

Avatar component for Vue.js

466,478 612
vue-avatar-3

A useful avatar component for Vue 3, with support for letter avatars.

7,661 1
@alexrafael10/vue-avatar

Avatar component for Vue.js

6,112 2
vue-nice-avatar

Dummy avatar generator

539 106
@webzlodimir/vue-avatar

Simple and easy to use avatar component for Vue 3

31,297 30

Version History

Version Released Vue License
0.1.15 ^2.6.11 MIT
0.1.14 ^2.6.11 MIT
0.1.13 ^2.6.11 MIT
0.1.12 ^3.6.10 MIT
0.1.11 ^3.6.10 MIT