-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
39 lines (37 loc) · 846 Bytes
/
App.vue
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
<template>
<div id="todolist">
<h1>待办事项</h1>
<need-do :list='list'></need-do>
<input type="text" v-model="new_todo" @keyup.enter='addNewTodo' placeholder="按确定键添加待办事项">
<h1>已完成</h1>
<has-done :list='list'></has-done>
</div>
</template>
<script>
import needDo from './needDo.vue';
import hasDone from './hasDone.vue';
const list = {
list: [
{ content: 'first', iscomplete: false },
{ content: 'second', iscomplete: false },
],
};
export default {
data() {
return {
list: list.list,
new_todo: '',
};
},
methods: {
addNewTodo() {
this.list.push({ content: this.new_todo, iscomplete: false });
this.new_todo = '';
},
},
components: {
needDo,
hasDone,
},
};
</script>