Skip to content

Commit bb9052a

Browse files
committed
(docs) add CDN usage
1 parent 60ab14b commit bb9052a

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ npm install --save vue-advanced-chat
7474

7575
# Using yarn
7676
yarn add --save vue-advanced-chat
77+
78+
# Using CDN
79+
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-advanced-chat.min.js"></script>
7780
```
7881

7982
If you want to send mp3 audio messages, you may need to install `lamejs` inside your project:
@@ -86,7 +89,7 @@ npm install lamejs --save
8689

8790
## Usage
8891

89-
You can import it as a custom component:
92+
#### You can import it as a custom component:
9093

9194
```javascript
9295
<template>
@@ -116,6 +119,27 @@ You can import it as a custom component:
116119
</script>
117120
```
118121

122+
#### Or if you used CDN import:
123+
124+
```javascript
125+
<template>
126+
<vue-advanced-chat
127+
:current-user-id="currentUserId"
128+
:rooms="rooms"
129+
:messages="messages"
130+
/>
131+
</template>
132+
133+
<script>
134+
export default {
135+
mounted() {
136+
document.querySelector('vue-advanced-chat').rooms = []
137+
document.querySelector('vue-advanced-chat').messages = []
138+
}
139+
}
140+
</script>
141+
```
142+
119143
### Important notes
120144

121145
`vue-advanced-chat` component is performance oriented, hence you have to follow specific rules to make it work properly.
@@ -780,3 +804,7 @@ Your help is always appreciated :rocket:
780804
## License
781805

782806
This project is licensed under [MIT License](http://en.wikipedia.org/wiki/MIT_License)
807+
808+
```
809+
810+
```

0 commit comments

Comments
 (0)