-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
219 lines (213 loc) · 6.55 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./index.css">
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<body>
<div class="page-top">
<div class="pagecontent">
<h2>计划列表</h2>
</div>
</div>
<div class="main">
<h3 class="big-title">添加任务:</h3>
<input type="text" class="task-input" v-model='inputValue' @keyup.enter='addTodo'>
<ul class="task-count">
<li>{{filterList}}个任务未完成</li>
<li class="action">
<a href="#all">所有任务</a>
<a href="#unfinish">未完成任务</a>
<a href="#finish">完成任务</a>
</li>
</ul>
<h3 class="big-title">任务列表:</h3>
<div class="tasks">
<span class="no-tasl-tip" v-show='!list.length'>未添加任何项目</span>
<ul class="todo-list">
<li class="list" v-for='item in filterCheck'
v-bind:class='{completed:item.checked,editing:editingTodo === item}'>
<div class="view">
<input type="checkbox" class="toggle" v-model='item.checked'>
<label for="" @dblclick="editTodo(item)">{{item.title}}</label>
<button class="destory" @click="deleteTodo(item)">X</button>
</div>
<input type="text" class="edit" v-focus='editingTodo===item' v-model='item.title'
@keyup.enter='editedTodo' @blur='editedTodo' @keyup.esc='cancleEdit(item)'>
</li>
</ul>
</div>
</div>
<script src="./index.js"></script>
</body>
</html>
<!-- // function vElement(tagName,prop,children) {
// if(!(this instanceof vElement)){
// return new vElement(tagname,prop,children)
// }
// if(Object.portotype.toString.call(prop) === "[object Array]"){
// children = prop;
// porp = {}
// }
// this.tagname = tagname;
// this.children = children;
// this.prop = porp;
// var count = 0;
// this.children.forEach(function(child, index){
// if(child instanceof vElement){
// count += child.count;
// }
// count++;
// })
// this.count = count;
// }
// vElement.prototype.render = function() {
// var el = document.creatElement(this.tagName);
// var children = this.children;
// var prop = this.prop;
// for(var item in prop){
// var curProp = prop[item];
// el.setAttribute(item, curProp);
// }
// children.forEach(function(child, index) {
// if(child instanceof vElement){
// var childDom = child.render();
// }else{
// var childDom = document.creatTextNode(child)
// }
// el.appendChild(childDom);
// })
// return el;
// } -->
<!-- <div class="wrapper">
<p>good good study</p>
</div>
<div id="app">
{{message}}
</div>
<div id="app-2">
<span v-bind:title = 'message'>
鼠标悬停查看此处动态绑定的提示信息
</span>
</div>
<div id="app-3">
<p v-if="seen">
现在你看到我了!
</p>
</div>
<div id="app-4">
<ol>
<li v-for="todo in todos">
{{todo.text}}
</li>
</ol>
</div>
<div id="app-5">
<p>{{message}}</p>
<button @click="reverseMessage">reverseMessage</button>
</div>
<div id="app-6">
<p>{{message}}</p>
<input type="text" v-model="message">
</div>
<div id="app-7">
<ol>
<todo-item
v-for='item in groceryList'
v-bind:todo='item'
v-bind:key='item.id'>
</todo-item>
</ol>
</div>
<div id="app-8">
<p>{{foo}}</p>
<button @click="foo = 'baz'">Change it</button>
</div>
<div id="app-9">
<template v-if="loginType==='username'">
<label for="">Username</label>
<input type="text" placeholder="Enter your username" key="username-input">
</template>
<template v-else>
<label for="">Email</label>
<input type="text" placeholder="Enter your email address" key="email-input">
</template>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script>
console.dir(document)
var app = new Vue({
el: '#app',
data: {
message: 'Hellp Vue!'
}
})
var app2 = new Vue({
el: '#app-2',
data: {
message: '页面加载于' + new Date().toLocaleString()
}
})
var app3 = new Vue({
el: "#app-3",
data: {
seen: true
}
})
var app4 = new Vue({
el: '#app-4',
data: {
todos: [
{text:'Learn JavaScript'},
{text: 'Learn Vue'},
{text: 'Make project'}
]
}
})
var app5 = new Vue({
el: '#app-5',
data: {
message: 'Hello Vue.js!'
},
methods: {
reverseMessage: function() {
this.message = this.message.split('').reverse().join('')
}
}
})
var app6 = new Vue({
el: '#app-6',
data: {
message: 'Hello Vue!'
}
})
Vue.component('todo-item',{
props: ['todo'],
template: '<li>{{todo.text}}</li>'
})
var app7 = new Vue({
el: '#app-7',
data: {
groceryList:[
{id: 0, text: 'vegetable'},
{id: 1, text: 'cheese'},
{id: 2, text: 'anything'}
]
}
})
var obj = {
foo:'bar'
}
// Object.freeze(obj)
var app8 = new Vue({
el: '#app-8',
data: obj
})
var app9 = new Vue({
el: '#app-9',
})
</script> -->