You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.1 KiB
HTML
61 lines
2.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<title>Vue-Socket.io</title>
|
|
|
|
<!-- Bootstrap -->
|
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
|
|
<div class="container">
|
|
|
|
<div v-if="!join" id="join" class="text-center">
|
|
<div class="form-group">
|
|
<input type="text" max="12" class="form-control input-lg text-center" v-model="name" placeholder="Name">
|
|
</div>
|
|
<button @click="joinChat(name)" class="btn btn-primary btn-lg">Join Chat</button>
|
|
</div>
|
|
|
|
<div v-if="join" id="group">
|
|
<div class="users">
|
|
<h4>Users</h4>
|
|
<ul class="list-unstyled">
|
|
<li v-for="user in users" track-by="$index">{{user}}</li>
|
|
</ul>
|
|
</div>
|
|
<div class="chat">
|
|
|
|
<div class="messages">
|
|
<ul class="list-unstyled">
|
|
<li v-for="m in messages" :class="{me: (m.name === name)}">{{m.name}} - {{m.message}}</li>
|
|
</ul>
|
|
</div>
|
|
|
|
|
|
<div class="input">
|
|
<form @submit.prevent="send(message)">
|
|
<div class="input-group">
|
|
<input type="text" class="form-control" v-model="message" placeholder="uyudun mu?...">
|
|
<span class="input-group-btn">
|
|
<button class="btn btn-default" type="submit">-></button>
|
|
</span>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.22/vue.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.4.6/socket.io.min.js"></script>
|
|
<script src="test.js"></script>
|
|
<script src="script.js"></script>
|
|
</body>
|
|
</html> |