forked from vue-bulma/vue-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
executable file
·97 lines (81 loc) · 1.87 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
92
93
94
95
96
97
<template>
<div id="app">
<nprogress-container></nprogress-container>
<navbar :show="true"></navbar>
<sidebar :show="sidebar.opened && !sidebar.hidden"></sidebar>
<app-main></app-main>
<footer-bar></footer-bar>
</div>
</template>
<script>
import NprogressContainer from 'vue-nprogress/src/NprogressContainer'
import { Navbar, Sidebar, AppMain, FooterBar } from 'components/layout/'
import { mapGetters, mapActions } from 'vuex'
export default {
components: {
Navbar,
Sidebar,
AppMain,
FooterBar,
NprogressContainer
},
beforeMount () {
const { body } = document
const WIDTH = 768
const RATIO = 3
const handler = () => {
if (!document.hidden) {
let rect = body.getBoundingClientRect()
let isMobile = rect.width - RATIO < WIDTH
this.toggleDevice(isMobile ? 'mobile' : 'other')
this.toggleSidebar({
opened: !isMobile
})
}
}
document.addEventListener('visibilitychange', handler)
window.addEventListener('DOMContentLoaded', handler)
window.addEventListener('resize', handler)
},
computed: mapGetters({
sidebar: 'sidebar'
}),
methods: mapActions([
'toggleDevice',
'toggleSidebar'
])
}
</script>
<style lang="scss">
@import '~animate.css';
.animated {
animation-duration: .377s;
}
@import '~bulma';
@import '~wysiwyg.css/wysiwyg.sass';
$fa-font-path: '~font-awesome/fonts/';
@import '~font-awesome/scss/font-awesome';
html {
background-color: whitesmoke;
}
.nprogress-container {
position: fixed !important;
width: 100%;
height: 50px;
z-index: 2048;
pointer-events: none;
#nprogress {
$color: #48e79a;
.bar {
background: $color;
}
.peg {
box-shadow: 0 0 10px $color, 0 0 5px $color;
}
.spinner-icon {
border-top-color: $color;
border-left-color: $color;
}
}
}
</style>