-
Notifications
You must be signed in to change notification settings - Fork 26
/
index.html
98 lines (98 loc) · 4.16 KB
/
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!doctype html>
<html data-framework="vue">
<head>
<meta charset="utf-8">
<title>LeanTodo • Vue.js</title>
<link rel="stylesheet" href="https://unpkg.com/todomvc-app-css/index.css">
<style>
[v-cloak] { display: none; }
.userinfo {
position: absolute;
bottom: -46px;
width: 100%;
font-size: 100%;
}
#login input {
padding: 16px;
text-align: center;
}
#login input:disabled {
color: #ddd;
cursor: not-allowed;
}
#login .control {
display: flex;
}
#login-button {
background-color: #fafafa;
}
</style>
</head>
<body>
<section class="todoapp">
<h1>LeanTodo</h1>
<form action="#" id="login" v-if="!user" v-cloak>
<input v-model="username" autofocus required class="new-todo" placeholder="Username">
<input type="password" v-model="password" required class="new-todo" placeholder="Password">
<div class="control">
<button class="new-todo" @click="handleLogin" id="login-button">Login</button>
<button class="new-todo" @click="handleSignUp">Signup</button>
</div>
</form>
<template v-if="user" v-cloak>
<header class="header">
<input class="new-todo"
v-if="user"
autofocus autocomplete="off"
placeholder="What needs to be done?"
v-model="content"
@keyup.enter="handleCreateTodo">
</header>
<section class="main" v-show="todos.length">
<ul class="todo-list">
<li v-for="todo in filteredTodos"
class="todo"
:key="todo.objectId"
:class="{ completed: todo.done, editing: todo.objectId == editingId }">
<div class="view">
<input class="toggle" type="checkbox" v-model="todo.done" @change="handleToggleDone(todo)">
<label @dblclick="handleEditTodo(todo)">{{ todo.content }}</label>
<button class="destroy" @click="handleRemoveTodo(todo)"></button>
</div>
<input class="edit" type="text"
v-model="editingContent"
v-todo-focus="todo.objectId == editingId"
@blur="handleFinishEditTodo(todo)"
@keyup.enter="handleFinishEditTodo(todo)"
@keyup.esc="handleFinishEditTodo(todo)">
</li>
</ul>
</section>
<footer class="footer" v-show="todos.length" v-cloak>
<span class="todo-count">
<strong>{{ remaining }}</strong> {{ remaining | pluralize }} left
</span>
<ul class="filters">
<li><a href="#/all" :class="{ selected: visibility == 'all' }">All</a></li>
<li><a href="#/active" :class="{ selected: visibility == 'active' }">Active</a></li>
<li><a href="#/completed" :class="{ selected: visibility == 'completed' }">Completed</a></li>
</ul>
<button class="clear-completed" @click="handleRemoveCompleted" v-show="todos.length > remaining">
Clear completed
</button>
</footer>
<p class="info userinfo">
Logged in as {{user.username}} (<a @click='handleLogout'>Logout</a>)
</p>
</template>
</section>
<footer class="info">
<p>Double-click to edit a todo</p>
<p>fork from <a href="https://vuejs.org/v2/examples/todomvc.html">Vue.js TodoMVC</a> / Powered by <a href="https://leancloud.cn">LeanCloud</a></p>
</footer>
<a href="https://github.com/leancloud/leantodo-vue"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a>
<script src="https://unpkg.com/leancloud-storage/dist/av-live-query-min.js"></script>
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<script src="app.js"></script>
</body>
</html>