-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.vue
42 lines (40 loc) · 926 Bytes
/
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
<template>
<div>
<Header
:isMobile="isMobile"
:menuIsOpen="menuIsOpen"
@clicked="toggleMenu"
/>
<Main :isMobile="isMobile" :menuIsOpen="menuIsOpen" />
<Footer :isMobile="isMobile" />
</div>
</template>
<script lang="ts">
export default {
data() {
return {
menuIsOpen: false satisfies boolean,
mobileBreakpoint: 580 satisfies number,
isMobile: true satisfies boolean,
};
},
methods: {
checkScreenWidth(): boolean {
return (this.isMobile = window.innerWidth <= this.mobileBreakpoint);
},
toggleMenu(): void {
this.menuIsOpen = !this.menuIsOpen;
},
},
mounted() {
this.checkScreenWidth();
window.addEventListener("resize", this.checkScreenWidth);
},
destroyed() {
window.removeEventListener("resize", this.checkScreenWidth);
},
};
</script>
<style lang="scss">
@import "@/assets/scss/styles.scss";
</style>