vue-avatar

An avatar component for vue.js

  • 所有者: eliep/vue-avatar
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    4
      比较:

Github星跟踪图

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.

主要指标

概览
名称与所有者eliep/vue-avatar
主编程语言JavaScript
编程语言JavaScript (语言数: 4)
平台
许可证MIT License
所有者活动
创建于2016-05-01 17:35:13
推送于2022-12-07 17:42:19
最后一次提交2021-05-02 17:14:48
发布数11
最新版本名称2.3.0 (发布于 )
第一版名称v1.0.0 (发布于 )
用户参与
星数620
关注者数8
派生数71
提交数104
已启用问题?
问题数45
打开的问题数5
拉请求数17
打开的拉请求数8
关闭的拉请求数30
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?