Skip to content

Commit 03bf39f

Browse files
committed
Update chat component, rename to Chat.vue
1 parent 788a7a0 commit 03bf39f

File tree

2 files changed

+44
-56
lines changed

2 files changed

+44
-56
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//Chat.vue
2+
3+
<template>
4+
<div id="talkjs-container" style="width: 100%; height: 500px">
5+
<i>Loading chat...</i>
6+
</div>
7+
</template>
8+
9+
<script setup>
10+
import Talk from "talkjs";
11+
import { onMounted } from 'vue';
12+
13+
onMounted(() => {
14+
Talk.ready.then(() => {
15+
const me = new Talk.User({
16+
id: 'nina',
17+
name: 'Nina',
18+
19+
photoUrl: 'https://talkjs.com/new-web/avatar-7.jpg',
20+
welcomeMessage: 'Hi!',
21+
});
22+
const session = new Talk.Session({
23+
appId: '<APP_ID>',
24+
me: me,
25+
});
26+
27+
const other = new Talk.User({
28+
id: 'frank',
29+
name: 'Frank',
30+
31+
photoUrl: 'https://talkjs.com/new-web/avatar-8.jpg',
32+
welcomeMessage: 'Hey, how can I help?',
33+
});
34+
35+
const conversation = session.getOrCreateConversation('new_conversation');
36+
conversation.setParticipant(me);
37+
conversation.setParticipant(other);
38+
39+
const chatbox = session.createChatbox();
40+
chatbox.select(conversation);
41+
chatbox.mount(document.getElementById('talkjs-container'));
42+
});
43+
});
44+
</script>

vue/vue-getting-started/src/components/Inbox.vue

-56
This file was deleted.

0 commit comments

Comments
 (0)