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.
70 lines
2.4 KiB
HTML
70 lines
2.4 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>
|
|
|
|
<h1 class="text-center">Vue-Socket.io</h1>
|
|
|
|
<div class="container">
|
|
<div v-if="!join" id="join" class="text-center">
|
|
<form @submit.prevent="joinChat(name)">
|
|
<div class="form-group">
|
|
<input type="text" max="12" class="form-control input-lg text-center" v-model="name" placeholder="Name">
|
|
</div>
|
|
<button class="btn btn-primary btn-lg" type="submit">Join Chat</button>
|
|
<br>
|
|
<a href="https://github.com/metinseylan/vue-socket.io">Github</a>
|
|
</form>
|
|
|
|
</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), clearfix: true}">
|
|
<div class="name">{{m.name}}</div>
|
|
<span>{{m.message}}</span>
|
|
</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="../vue-socketio.min.js"></script>
|
|
<script src="script.js"></script>
|
|
</body>
|
|
</html> |