mirror of
https://github.com/tenrok/vue-native-websocket.git
synced 2026-06-18 15:30:58 +03:00
example
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user