-
Notifications
You must be signed in to change notification settings - Fork 0
/
key-modifiers.html
73 lines (61 loc) · 2.37 KB
/
key-modifiers.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
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Eventos - Modificadores de teclado</title>
<link rel="stylesheet" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
<div id="events">
<div class="container">
<h1>Hcode Treinamentos</h1>
<form action="" class="form" @submit.prevent>
<div class="row">
<div class="col">
<div class="form-group">
<label for="">Nome</label>
<input type="text" class="form-control" name="username" placeholder="Digite seu nome" @keyup.enter="send($event)">
</div>
</div>
</div>
<div class="form-group">
<label for="">Pressione as teclas abaixo</label>
<input type="text" class="form-control" placeholder="Pressione Enter" @keyup.enter="exec">
<input type="text" class="form-control" placeholder="Pressione Tab" @keydown.tab="exec">
<input type="text" class="form-control" placeholder="Pressione Delete" @keyup.delete="exec">
<input type="text" class="form-control" placeholder="Pressione Esc" @keyup.esc="exec">
<input type="text" class="form-control" placeholder="Pressione Space" @keyup.space="exec">
<input type="text" class="form-control" placeholder="Pressione Up" @keyup.up="exec">
<input type="text" class="form-control" placeholder="Pressione Down" @keyup.down="exec">
<input type="text" class="form-control" placeholder="Pressione Left" @keyup.left="exec">
<input type="text" class="form-control" placeholder="Pressione Right" @keyup.right="exec">
</div>
</form>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
let app = new Vue({
el: '#events',
data: {
},
methods: {
alert() {
alert('Olá');
},
send(event) {
let form = event.target.form;
let data = new FormData(form);
for (let value of data.entries()) {
console.log(`${value[0]}: ${value[1]}`);
}
},
exec(e) {
console.log(e.key);
}
}
})
</script>
</body>
</html>