From 5f3666a1356fe430080fcdb44188c000f4d21ec2 Mon Sep 17 00:00:00 2001 From: Elie Prudhomme Date: Tue, 3 May 2016 14:07:19 +0200 Subject: [PATCH] Update documentation --- README.md | 30 +++++++++++++++++++++++++++++- index.html | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2eb11fa..2ada46a 100644 --- a/README.md +++ b/README.md @@ -20,11 +20,13 @@ You can find a few examples and the documentation [here](https://eliep.github.io `npm install vue-avatar` ## 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 ```js -import Avatar from 'vue-avatar' +import Avatar from 'vue-avatar/dist/Avatar' export default { ... @@ -41,9 +43,35 @@ After that, you can use it in your templates: ``` ### ES5 +```js +var Vue = require('vue') +var Avatar = require('vue-avatar') + +var YourComponent = Vue.extend({ + ... + components: { + 'avatar': Avatar.Avatar + }, + ... +}) +``` ### Browser +``` + + + +new Vue({ + ... + components: { + 'avatar': Avatar.Avatar + }, + ... +}) +``` + + ## Props diff --git a/index.html b/index.html index c64a9d2..0b89639 100644 --- a/index.html +++ b/index.html @@ -74,11 +74,13 @@

Installation

npm install vue-avatar

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'
+import Avatar from 'vue-avatar/dist/Avatar'
 
 export default {
 
@@ -94,6 +96,36 @@ 

ES6

which will render to:

+ + +

ES5

+ +

+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': Avatar.Avatar
+  }
+})
+        
+

Props