-
Notifications
You must be signed in to change notification settings - Fork 19
/
index.html
58 lines (45 loc) · 1.64 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
<!doctype html>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Vue.js 3 Login (with Composition API)</title>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.15.3/css/all.css">
<link rel="stylesheet" href="./styles.css">
<script src="https://cdn.jsdelivr.net/npm/vue@3"></script>
<div id="app">
<div id="login">
<div id="description">
<h1>Login</h1>
<p>By logging in you agree to the ridiculously long terms that you didn't bother to read.</p>
</div>
<div id="form">
<form @submit.prevent="doLogin">
<label for="email">Email</label>
<input type="text" id="email" v-model="email" placeholder="elon@musk.io" autocomplete="off">
<label for="password">Password</label>
<i class="fas" :class="[passwordFieldIcon]" @click="hidePassword = !hidePassword"></i>
<input :type="passwordFieldType" id="password" v-model="password" placeholder="**********">
<button type="submit">Log in</button>
</form>
</div>
</div>
</div>
<script>
Vue.createApp({
setup() {
const email = Vue.ref("");
const hidePassword = Vue.ref(true);
const password = Vue.ref("");
const passwordFieldIcon = Vue.computed(() => hidePassword.value ? "fa-eye" : "fa-eye-slash");
const passwordFieldType = Vue.computed(() => hidePassword.value ? "password" : "text");
const doLogin = () => alert("Not implemented yet :O");
return {
email,
hidePassword,
password,
passwordFieldIcon,
passwordFieldType,
doLogin
}
}
}).mount("#app");
</script>