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?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?