-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathApp.vue
91 lines (81 loc) · 1.74 KB
/
App.vue
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<script setup lang="ts">
import { onMounted } from 'vue';
import Home from './pages/Home.vue'
import Result from './pages/Result.vue'
import Loading from './components/Loading.vue'
let oreoList = $ref<OreoKey[]>([])
let loading = $ref(true)
let animating = $ref(true)
onMounted(() => {
setTimeout(() => {
loading = false
}, 1000)
})
const handleSubmit = (newList: OreoKey[]) => {
if(newList.length) {
loading = true
setTimeout(() => {
loading = false
}, 1000)
oreoList = [...newList]
}
}
</script>
<template>
<div
flex="~ col" items-center box-border
min-h-screen w-screen
bg="#caad9f" p-12
>
<div v-show="animating" absolute inset-0 flex items-center justify-center>
<Transition
appear name="bounce"
@before-enter="animating = true"
@after-leave="animating = false"
>
<Loading v-show="loading" />
</Transition>
</div>
<template v-if="!loading && !animating">
<Home v-if="!oreoList.length" @submit="handleSubmit" />
<Result v-else :oreoList="oreoList" @back="oreoList=[]" />
</template>
</div>
</template>
<style>
html,
body {
margin: 0;
padding: 0;
font-family: "Seto", sans-serif;
}
a {
color: #594439;
text-decoration: none;
}
a:hover {
color: #715c50;
}
@font-face {
font-family: "Seto";
src: url("./assets/fonts/Seto.woff") format("woff"),
url("./assets/fonts/Seto.ttf") format("truetype");
}
.bounce-enter-active {
animation: bounce-in 0.5s;
}
.bounce-leave-active {
animation: bounce-in 0.5s reverse;
}
@keyframes bounce-in {
0% {
transform: scale(0);
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
}
}
</style>