commit | author | age
|
b73b3b
|
1 |
<!DOCTYPE html> |
CM |
2 |
<html lang="en"> |
|
3 |
<head> |
|
4 |
<meta charset="UTF-8" /> |
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
|
6 |
<title>Vue Basics</title> |
|
7 |
<link |
|
8 |
href="https://fonts.googleapis.com/css2?family=Jost:wght@400;700&display=swap" |
|
9 |
rel="stylesheet" |
|
10 |
/> |
|
11 |
<link rel="stylesheet" href="styles.css" /> |
44695d
|
12 |
<script src="https://unpkg.com/vue@3.4.9/dist/vue.global.js"></script> |
b73b3b
|
13 |
<script src="app.js" defer></script> |
CM |
14 |
</head> |
|
15 |
<body> |
|
16 |
<header> |
|
17 |
<h1>Vue Lists and Conditional Content</h1> |
|
18 |
</header> |
|
19 |
<section id="assignment"> |
|
20 |
<h2>Assignment</h2> |
|
21 |
<!-- 1) Add code to manage a list of tasks in a Vue app --> |
|
22 |
<!-- When clicking "Add Task" a new task with the entered text should be added --> |
44695d
|
23 |
<input type="text" v-model="taskEntered"> |
CM |
24 |
<button @click="addTask">Add Task</button> |
|
25 |
<!-- <ul v-show="showTasks"> --> |
b73b3b
|
26 |
<!-- 2) Output the list of tasks here --> |
44695d
|
27 |
<!-- <li v-for="task in tasks">{{task}}</li> |
b73b3b
|
28 |
</ul> |
44695d
|
29 |
<ul v-show="!showTasks"> |
CM |
30 |
</ul> --> |
|
31 |
|
|
32 |
<ul > |
|
33 |
<!-- 2) Output the list of tasks here --> |
|
34 |
<li v-show="showTasks" v-for="task in tasks" :key="task">{{task}}</li> |
|
35 |
</ul> |
|
36 |
|
b73b3b
|
37 |
<!-- 3) When the below button is pressed, the list should be shown or hidden --> |
CM |
38 |
<!-- BONUS: Also update the button caption --> |
44695d
|
39 |
<button @click="toggleTasks">{{toggleTitle}} List</button> |
b73b3b
|
40 |
</section> |
CM |
41 |
</body> |
|
42 |
</html> |