vue-avatar

An avatar component for vue.js

  • Owner: eliep/vue-avatar
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    4
      Compare:

Github stars Tracking Chart

vue-avatar

Build Status

An avatar component for vue.js.

This component display an avatar image and if none is provided fallback to the
user initials. This component is highly inspired from
react-user-avatar.

Rules used to compute user initials:

  • divide the username on space and hyphen
  • use the first letter of each parts
  • never use more than three letters as initials
  • if the username is divided in more than three parts and has part
    starting with an uppercase, skip parts starting with a lowercase.

You can find a few examples and the documentation here

Installation

npm install vue-avatar

Version, Vuejs version, vue-avatar version, -------------, -----------------, ^1.0.18, ^1.3.0, ^2.0.0, ^2.0.0, ## Usage

vue-avatar is a UMD module, which can be used as a module in both CommonJS and AMD modular environments.
When in non-modular environment, Avatar will be registered as a global variable.

ES6


import Avatar from 'vue-avatar'

export default {
  ...
  components: {
    Avatar
  },
  ...
}

After that, you can use it in your templates:

<avatar username="Jane Doe"></avatar>

CommonJS

var Vue = require('vue')
var Avatar = require('vue-avatar')

var YourComponent = Vue.extend({
  ...
  components: {
    'avatar': Avatar.Avatar
  },
  ...
})

Browser

<script src="path/to/vue/vue.min.js"></script>
<script src="path/to/vue-avatar/dist/vue-avatar.min.js"></script>

new Vue({
  ...
  components: {
    'avatar': VueAvatar.Avatar
  },
  ...
})

Props

Event

Build Setup

# install dependencies
npm install

# serve gh pages with hot reload at localhost:8080/gh-pages/index.html
npm run dev

# build
npm run bundle

Test

npm test

License

Released under the MIT License.

Main metrics

Overview
Name With Ownereliep/vue-avatar
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 4)
Platform
License:MIT License
所有者活动
Created At2016-05-01 17:35:13
Pushed At2022-12-07 17:42:19
Last Commit At2021-05-02 17:14:48
Release Count11
Last Release Name2.3.0 (Posted on )
First Release Namev1.0.0 (Posted on )
用户参与
Stargazers Count620
Watchers Count8
Fork Count71
Commits Count104
Has Issues Enabled
Issues Count45
Issue Open Count5
Pull Requests Count17
Pull Requests Open Count8
Pull Requests Close Count30
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private