2016-04-16 04:20:35 +08:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
2016-11-29 19:49:33 +08:00
|
|
|
<title>Vue.js firebase + validation example</title>
|
2016-04-16 04:20:35 +08:00
|
|
|
<meta charset="utf-8">
|
|
|
|
<link rel="stylesheet" type="text/css" href="style.css">
|
|
|
|
<!-- Vue -->
|
2016-10-14 21:27:54 +08:00
|
|
|
<!-- Delete ".min" for console warnings in development -->
|
|
|
|
<script src="../../dist/vue.min.js"></script>
|
2016-04-16 04:20:35 +08:00
|
|
|
<!-- Firebase -->
|
2016-09-19 23:14:19 +08:00
|
|
|
<script src="https://www.gstatic.com/firebasejs/3.4.0/firebase.js"></script>
|
2016-04-16 04:20:35 +08:00
|
|
|
<!-- VueFire -->
|
2016-09-19 23:14:19 +08:00
|
|
|
<script src="https://unpkg.com/vuefire@1.3.0"></script>
|
2016-04-16 04:20:35 +08:00
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="app">
|
2016-07-14 06:35:02 +08:00
|
|
|
<ul is="transition-group">
|
|
|
|
<li v-for="user in users" class="user" :key="user['.key']">
|
|
|
|
<span>{{user.name}} - {{user.email}}</span>
|
|
|
|
<button v-on:click="removeUser(user)">X</button>
|
|
|
|
</li>
|
2016-04-16 04:20:35 +08:00
|
|
|
</ul>
|
|
|
|
<form id="form" v-on:submit.prevent="addUser">
|
2018-10-23 03:55:04 +08:00
|
|
|
<input v-model="newUser.name" placeholder="Add Name">
|
|
|
|
<input v-model="newUser.email" placeholder="Add Email">
|
2016-04-16 04:20:35 +08:00
|
|
|
<input type="submit" value="Add User">
|
|
|
|
</form>
|
|
|
|
<ul class="errors">
|
|
|
|
<li v-show="!validation.name">Name cannot be empty.</li>
|
|
|
|
<li v-show="!validation.email">Please provide a valid email address.</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<script src="app.js"></script>
|
|
|
|
</body>
|
|
|
|
</html>
|