commit | author | age
|
778328
|
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" /> |
|
12 |
<script src="https://unpkg.com/vue@3.4.9/dist/vue.global.js" defer></script> |
|
13 |
<script src="app.js" defer></script> |
|
14 |
</head> |
|
15 |
<body> |
|
16 |
<header> |
|
17 |
<h1>Events</h1> |
|
18 |
</header> |
|
19 |
<section id="assignment"> |
|
20 |
<h2>Event Practice</h2> |
|
21 |
<!-- 1) Show an alert (any text of your choice) when the button is pressed --> |
|
22 |
<button v-on:click="myAlert">Show Alert</button> |
|
23 |
<hr /> |
|
24 |
<!-- 2) Register the user input on "keydown" and output it in the paragraph (hint: event.target.value helps) --> |
|
25 |
<input type="text" v-on:keydown="myKeydown" /> |
|
26 |
<p>{{ kdInput }}</p> |
|
27 |
<hr /> |
|
28 |
<!-- 3) Repeat 2) but only output the entered value if the ENTER key was pressed --> |
|
29 |
<input |
|
30 |
type="text" |
|
31 |
v-on:keydown="myKeydown" |
|
32 |
v-on:keyup.enter="myKeyEnter" |
|
33 |
/> |
|
34 |
<p>{{ keInput }}</p> |
|
35 |
</section> |
|
36 |
</body> |
|
37 |
</html> |