Events in Vue Chat UI component component
17 Dec 20257 minutes to read
This section describes the Chat UI events that will be triggered when appropriate actions are performed. The following events are available in the Chat UI component.
Created
The Chat UI component triggers the created event when the component rendering is completed.
<template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :created="created" :user="currentUser"></ejs-chatui>
</div>
</template>
<script setup>
import { ChatUIComponent as EjsChatui } from "@syncfusion/ej2-vue-interactive-chat";
const created = () => {
// Your required action here
};
const currentUser = {
id: "user1",
user: "Albert"
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style><template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :created="created" :user="currentUser"></ejs-chatui>
</div>
</template>
<script>
import { ChatUIComponent } from "@syncfusion/ej2-vue-interactive-chat";
export default {
components: {
'ejs-chatui': ChatUIComponent
},
data() {
return {
currentUser: {
id: "user1",
user: "Albert",
},
created: () => {
// Your required action here
}
};
},
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style>Sending message
The messageSend event is triggered before sending a message in the Chat UI component.
<template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :messageSend="messageSend" :user="currentUser"></ejs-chatui>
</div>
</template>
<script setup>
import { ChatUIComponent as EjsChatui } from "@syncfusion/ej2-vue-interactive-chat";
const currentUser = {
id: "user1",
user: "Albert"
};
const messageSend = () => {
// Your required action here
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style><template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :messageSend="messageSend" :user="currentUser"></ejs-chatui>
</div>
</template>
<script>
import { ChatUIComponent } from "@syncfusion/ej2-vue-interactive-chat";
export default {
components: {
'ejs-chatui': ChatUIComponent
},
data() {
return {
currentUser: {
id: "user1",
user: "Albert",
},
messageSend: () => {
// Your required action here
}
};
},
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style>User Typing
The userTyping event is triggered when the user is typing a message in the Chat UI component.
<template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :userTyping="userTyping" :user="currentUser"></ejs-chatui>
</div>
</template>
<script setup>
import { ChatUIComponent as EjsChatui } from "@syncfusion/ej2-vue-interactive-chat";
const userTyping = () => {
// Your required action here
};
const currentUser = {
id: "user1",
user: "Albert"
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style><template>
<div id='container' style="height: 380px; width: 450px; margin: 0 auto;">
<ejs-chatui :userTyping="userTyping" :user="currentUser"></ejs-chatui>
</div>
</template>
<script>
import { ChatUIComponent } from "@syncfusion/ej2-vue-interactive-chat";
export default {
components: {
'ejs-chatui': ChatUIComponent
},
data() {
return {
currentUser: {
id: "user1",
user: "Albert",
},
userTyping: () => {
// Your required action here
}
};
},
};
</script>
<style>
@import "../node_modules/@syncfusion/ej2-base/styles/material.css";
@import "../node_modules/@syncfusion/ej2-inputs/styles/material.css";
@import "../node_modules/@syncfusion/ej2-navigations/styles/material.css";
@import "../node_modules/@syncfusion/ej2-buttons/styles/material.css";
@import "../node_modules/@syncfusion/ej2-popups/styles/material.css";
@import "../node_modules/@syncfusion/ej2-interactive-chat/styles/material.css";
@import "../node_modules/@syncfusion/ej2-splitbuttons/styles/material.css";
</style>Before attachment upload
The beforeAttachmentUpload event is triggered before attached files begin uploading in the Chat UI.
Attachment upload success
The attachmentUploadSuccess event is triggered when an attached file is successfully uploaded in the Chat UI.
Attachment upload failure
The attachmentUploadFailure event is triggered when an attached file upload fails in the Chat UI.
Attachment removed
The attachmentRemoved event is triggered when an attached file is removed from the Chat UI.
Attachment click
The attachmentClick event is triggered when an attached file is clicked in the Chat UI.