Chat Overview
The Chat component allows the user to take part in chat sessions with other users or with chat bots.
The Chat wrapper for Vue is a client-side wrapper for the Kendo UI Chat widget.
Basic Usage
The following example demonstrates how to initialize the Chat.
Installation
To initialize the Chat, either:
Initializing with Webpack
-
Install Kendo UI and add a theme.
npm install --save @progress/kendo-ui npm install --save @progress/kendo-theme-default
-
Install the Kendo UI Chat package for Vue.
npm install --save @progress/kendo-chat-vue-wrapper
-
Import the Kendo UI packages to the App component. If you use the Kendo UI components more than once in your application, add all Kendo UI-related files to the
main.js
file. If you use the Kendo UI components once in your application, add the Kendo UI-related files to the component where they will be referred.import '@progress/kendo-ui' // This will import the entire Kendo UI library // As an alternative, you could import only the scripts that are used by a specific widget: // import '@progress/kendo-ui/js/kendo.chat' // Imports only the Chat script and its dependencies import '@progress/kendo-theme-default/dist/all.css' import { Chat, ChatInstaller } from '@progress/kendo-chat-vue-wrapper' Vue.use(ChatInstaller) new Vue({ el: '#app', components: { Chat } })
Functionality and Features
Events
The following example demonstrates basic Chat events. You can subscribe to all Chat events by their handler name.
<div id="vueapp" class="vue-app">
<kendo-chat ref="chat"
v-on:post="onPost"
v-on:sendmessage="onSendMessage"
v-on:actionclick="onActionClick"
v-on:typingstart="onTypingStart"
v-on:typingend="onTypingEnd"></kendo-chat>
</div>
Vue.use(ChatInstaller);
new Vue({
el: '#vueapp',
methods: {
onPost: function (ev) {
console.log("A message has been posted to the Chat widget!");
},
onSendMessage: function (ev) {
console.log("A message has been posted to the Chat widget using the message box!");
},
onActionClick: function (ev) {
console.log("The user clicked an action button in attachment template, or selected a suggestedAction!");
},
onTypingStart: function (ev) {
console.log("The user started typing in the Chat message box!");
},
onTypingEnd: function (ev) {
console.log("The user cleared the Chat message box!");
}
}
})