-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
33 lines (33 loc) · 995 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE html>
<html>
<head>
<title>Vue Socket.io</title>
</head>
<body>
<h1>Chat</h1>
<div id="app">
<div v-if="state == 0">
<h3>Please choose a username</h3>
<form @submit.prevent="setUsername">
<input type="text" placeholder="Username..." v-model:value="username" />
<input type="submit" value="Join" />
</form>
<button @click="continueWithoutUsername">Join as a Guest</button>
</div>
<div v-if="state == 1">
<ul id="chatbox">
<li v-for="message in messages">
<b>{{ message.user }}:</b> {{ message.message }}
</li>
</ul>
<form @submit.prevent="sendMessage">
<input type="text" placeholder="Message..." v-model:value="message" />
<input type="submit" value="Send" />
</form>
</div>
</div>
<script src="/socket.io/socket.io.js"></script>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src='chatVue.js'></script>
</body>
</html>