forked from tookit/vue-material-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.vue
88 lines (86 loc) · 2.18 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
<template>
<v-app dark>
<router-view></router-view>
<!-- theme setting -->
<v-btn small fab dark fixed top="top" right="right" class="setting-fab" color="red" @click="openThemeSettings">
<v-icon>mdi-silverware-variant</v-icon>
</v-btn>
<v-btn small fab dark fixed top="top" right="right" class="chat-fab" color="primary" @click="openOnlineUser">
<v-icon>mdi-chat</v-icon>
</v-btn>
<!-- setting drawer -->
<v-navigation-drawer v-model="rightDrawer" class="setting-drawer" temporary right hide-overlay fixed>
<template v-if="showSetting">
<theme-settings />
</template>
<template v-else>
<online-user />
</template>
</v-navigation-drawer>
<!-- global snackbar -->
<v-snackbar v-model="snackbar.show" :timeout="3000" app top centered :color="snackbar.color">
{{ snackbar.text }}
<template #action="{ attrs }">
<v-btn icon v-bind="attrs" @click="$store.commit('HIDE_SNACKBAR')">
<v-icon>mdi-close</v-icon>
</v-btn>
</template>
</v-snackbar>
</v-app>
</template>
<script>
import ThemeSettings from '@/components/ThemeSettings'
import OnlineUser from '@/components/OnlineUser'
import { mapGetters } from 'vuex'
export default {
components: {
ThemeSettings,
OnlineUser,
},
data() {
return {
rightDrawer: false,
showSetting: true,
}
},
computed: {
...mapGetters(['getSnackbar']),
snackbar: {
get() {
return this.getSnackbar
},
set(val) {
this.$store.commit('UPDATE_SNACKBAR', val)
},
},
},
mounted() {
if (typeof window !== undefined && window._VMA === undefined) {
window._VMA = this
}
},
created() {},
methods: {
openThemeSettings() {
this.$vuetify.goTo(0)
this.showSetting = true
this.rightDrawer = !this.rightDrawer
},
openOnlineUser() {
this.$vuetify.goTo(0)
this.showSetting = false
this.rightDrawer = !this.rightDrawer
},
},
}
</script>
<style lang="sass" scoped>
.setting-fab
top: 50% !important
right: 0
border-radius: 0
.chat-fab
top: calc(50% + 40px) !important
right: 0
border-radius: 0
</style>