-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
128 lines (114 loc) · 4.91 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
<!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">
<link rel="stylesheet" href="./css/normalize.css">
<script src="./js/icon.js"></script>
<link rel="stylesheet" href="./css/vue_p1.css">
<title>vue清单练习</title>
</head>
<body>
<header class="nav">
<h3>vue列表清单</h3>
</header>
<div id="main">
<h4>开黑了么就写作业?</h4>
<div class="container">
<div class="wrap">
<form @submit.prevent="merge" action="" id="task-form">
<input placeholder="请开始搞事情..." v-model="current.title" autocomplete="off" type="text" value="" id="input-task">
<i @click="merge" class="icon-list add">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-iconjia"></use>
</svg>
</i>
<i @click="showList" class="icon-list more">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-icon4"></use>
</svg>
</i>
<transition :duration="200" name="fade">
<div v-if="moreList||current.id" class="more-list">
<div class="detail">
<textarea rows="8" placeholder="详情描述..." v-model="current.details" name="" id="task-detail"></textarea>
</div>
<p>定时提醒</p>
<input v-model="current.alert_time" type="date" name="" id="">
<button type="submit">提交</button>
</div>
</transition>
</form>
</div>
<div class="wrap">
<div class="tasklist">
<task :todo="todo" v-if="!todo.complete" v-for="(todo,index) in list">
</task>
</div>
</div>
<p>已完成
</p>
<div class="wrap completed">
<div class="tasklist">
<task :todo="todo" v-if="todo.complete" v-for="(todo,index) in list">
</task>
<!-- <div v-if="todo.complete" v-for="(todo,index) in list" class="complete">
<button @click="toggle_complete(todo.id)">未完成</button> {{todo.title}}
<button @click="set_current(todo)">修改</button>
<button @click="remove(todo.id)">删除</button>
</div> -->
</div>
</div>
</div>
</div>
<template id="task-list-tp">
<div class="complete">
<!-- 图标及标题点击后翻转事件完成状态 -->
<span @click="action('toggle_complete',todo.id)">
<span v-if="!todo.complete">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-wancheng"></use>
</svg>
</span>
<span v-if="todo.complete">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-wancheng1"></use>
</svg>
</span>
</span>
<span @click="action('toggle_complete',todo.id)">{{todo.title}}</span>
<!-- 渲染列表hover后acion操作 -->
<div class="action">
<span v-if="!todo.complete" class="icon-list edit-icon" @click="action('set_current',todo)">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-bianji"></use>
</svg>
</span>
<span class="icon-list delete-icon" @click="action('remove',todo.id)">
<svg class="icon" aria-hidden="true">
<use xlink:href="#icon-shanchu"></use>
</svg>
</span>
</div>
<!-- 方法一:嵌套循环 -->
<!-- <div v-for="value of todo">
{{value}}
</div> -->
<!-- 方法二 -->
<!-- <div>
key:{{Object.getOwnPropertyNames(todo)[0]}}
</div> -->
<!-- <div>
value:{{todo[Object.getOwnPropertyNames(todo)[0]]}}
</div> -->
</div>
</template>
<audio id="alert_time" controls>
<source src="./src/mp3/alert_time.mp3">
</audio>
<script src="./js/vue.js"></script>
<script src="./js/myStory.js"></script>
<script src="./js/vue-list.js"></script>
</body>
</html>