Skip to content

Commit 5f3666a

Browse files
author
Elie Prudhomme
committed
Update documentation
1 parent 1e0b10b commit 5f3666a

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,13 @@ You can find a few examples and the documentation [here](https://eliep.github.io
2020
`npm install vue-avatar`
2121

2222
## Usage
23+
vue-avatar is a UMD module, which can be used as a module in both CommonJS and AMD modular environments.
24+
When in non-modular environment, Avatar will be registered as a global variable.</p>
2325

2426
### ES6
2527
```js
2628

27-
import Avatar from 'vue-avatar'
29+
import Avatar from 'vue-avatar/dist/Avatar'
2830

2931
export default {
3032
...
@@ -41,9 +43,35 @@ After that, you can use it in your templates:
4143
```
4244

4345
### ES5
46+
```js
47+
var Vue = require('vue')
48+
var Avatar = require('vue-avatar')
49+
50+
var YourComponent = Vue.extend({
51+
...
52+
components: {
53+
'avatar': Avatar.Avatar
54+
},
55+
...
56+
})
57+
```
4458

4559
### Browser
4660

61+
```
62+
<script src="path/to/vue/vue.min.js"></script>
63+
<script src="path/to/vue-avatar/dist/vue-avatar.min.js"></script>
64+
65+
new Vue({
66+
...
67+
components: {
68+
'avatar': Avatar.Avatar
69+
},
70+
...
71+
})
72+
```
73+
74+
4775
## Props
4876
<table class="table">
4977
<thead><tr>

index.html

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,13 @@ <h2>Installation</h2>
7474
<pre><code class="language-html">npm install vue-avatar</code></pre>
7575

7676
<h2>Usage</h2>
77+
<p>vue-avatar is a UMD module, which can be used as a module in both CommonJS and AMD modular environments.
78+
When in non-modular environment, Avatar will be registered as a global variable.</p>
7779

7880
<h3>ES6</h3>
7981

8082
<pre><code class="language-javascript">
81-
import Avatar from 'vue-avatar'
83+
import Avatar from 'vue-avatar/dist/Avatar'
8284

8385
export default {
8486

@@ -94,6 +96,36 @@ <h3>ES6</h3>
9496
<p>which will render to:</p>
9597
<avatar username="Jane Doe"></avatar>
9698

99+
100+
101+
<h3>ES5</h3>
102+
103+
<pre><code class="language-javascript">
104+
var Vue = require('vue')
105+
var Avatar = require('vue-avatar')
106+
107+
var YourComponent = Vue.extend({
108+
components: {
109+
'avatar': Avatar.Avatar
110+
}
111+
})
112+
</code></pre>
113+
114+
115+
116+
<h3>Browser</h3>
117+
118+
<pre><code class="language-html">
119+
&lt;script src="path/to/vue/vue.min.js"&gt;&lt;/script&gt;
120+
&lt;script src="path/to/vue-avatar/dist/vue-avatar.min.js"&gt;&lt;/script&gt;
121+
122+
new Vue({
123+
components: {
124+
'avatar': Avatar.Avatar
125+
}
126+
})
127+
</code></pre>
128+
97129
<h2>Props</h2>
98130
<table class="table">
99131
<thead><tr>

0 commit comments

Comments
 (0)