/
index.html
71 lines (65 loc) · 1.95 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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Vue.js App</title>
<link rel="stylesheet" href="./main.css">
</head>
<body>
<div id="app">
<h1>チュートリアルToDoリスト</h1>
<!-- ★STEP11 -->
<label v-for="label in options" >
<input type="radio"
v-model="current"
v-bind:value="label.value">{{ label.label }}
</label>
<!-- ★STEP12 -->
({{ computedTodos.length }} 件を表示)
<!-- ★STEP4 リスト用テーブル -->
<table>
<thead v-pre>
<tr>
<th class="id">ID</th>
<th class="comment">コメント</th>
<th class="state">状態</th>
<th class="button">-</th>
</tr>
</thead>
<tbody>
<!-- ★STEP5 ToDo の要素をループ -->
<tr
v-for="item in computedTodos"
v-bind:key="item.id"
v-bind:class="{done:item.state}">
<th>{{ item.id }}</th>
<td>{{ item.comment }}</td>
<td class="state">
<!-- ★STEP10 状態変更ボタン -->
<button v-on:click="doChangeState(item)">
{{ labels[item.state] }}
</button>
</td>
<td class="button">
<!-- ★STEP10 削除ボタン -->
<button v-on:click.ctrl="doRemove(item)">
削除
</button>
</td>
</tr>
</tbody>
</table>
<p>※削除ボタンはコントロールキーを押しながらクリックして下さい</p>
<!-- ★STEP6 -->
<h2>新しい作業の追加</h2>
<form class="add-form" v-on:submit.prevent="doAdd">
<!-- コメント入力フォーム -->
コメント <input type="text" ref="comment">
<!-- 追加ボタンのモック -->
<button type="submit">追加</button>
</form>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script src="./main.js"></script>
</body>
</html>