├── .gitignore ├── README.md ├── bili.config.js ├── package.json └── src ├── BubbleChat.vue └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | dist 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # vue-bubble-chat 2 | 3 | Amesome & simple vue chat component 4 | 5 | 6 | 7 | 8 | 9 | ![preview](https://media.giphy.com/media/hrSR25LGrBp8lco4tO/giphy.gif) 10 | 11 | 12 | ## Installation 13 | 14 | ```bash 15 | npm install --save vue-bubble-chat 16 | ``` 17 | 18 | ## Usage 19 | 20 | ```vue 21 | import Vue from "vue"; 22 | import BubbleChat from "vue-bubble-chat"; 23 | 24 | Vue.use(BubbleChat); 25 | ``` 26 | 27 | ----------------------------------------------------------------------- 28 | ### Params 29 | 30 | | Param name | Data | Description | 31 | | ------------- | ------------- |------------- | 32 | | position | type: string, default: 'right' | horizontal position on your page, receives 'left' or 'right' values | 33 | | messages | type: array, default: [ ] | objects array with all your chat messages | 34 | | text-field | type: string | name of key which is equel to your message | 35 | | sender-name-field | type: string | name of key which is equel to user's name | 36 | | avatar-link-field | type: string | name of key which is equel to user's avatar link; by default it will be simple circle with the first letter of user's name | 37 | 38 | ### Events 39 | 40 | | Event name | Data | Description 41 | | ------------- | ------------- |------------- | 42 | | chatWasUpdated | object: {chatState: [{...}, {...}, ...]} | return a an object with chatState key where will be stored full messages array 43 | 44 | ----------------------------------------------------------------------- 45 | 46 | ## Example 47 | ```vue 48 | 58 | 59 | 240 | 241 | 918 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import BubbleChat from "./BubbleChat.vue"; 2 | 3 | export default { 4 | install(Vue, options) { 5 | Vue.component("bubble-chat", BubbleChat); 6 | } 7 | }; --------------------------------------------------------------------------------