Repository navigation
Expand file tree
/
Copy pathMain.vue
More file actions
105 lines (96 loc) · 3.55 KB
/
Copy pathMain.vue
File metadata and controls
105 lines (96 loc) · 3.55 KB
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
98
99
100
101
102
103
104
<template lang="pug">
v-app
v-navigation-drawer(v-model='drawer',:mini-variant.sync="mini", persistent,enable-resize-watcher, :light="!dark")
.pa-3.text-xs-center(v-show="!mini", :class="{'light--text': dark}")
div.display-2.py-4 Adminify
p {{$t('An admin dashboard based on Vuetify')}}
div(style="padding-left:5em")
v-switch(:label="(!dark ? 'Light' : 'Dark') + ' Theme'", v-model="dark", :light="dark", hide-details)
div
v-btn(light, tag="a", href="https://github.com/wxs77577/adminify", primary)
v-icon(left, light) star
span Github
.pa-3.text-xs-center(v-show="mini")
.display-2 A
v-divider
v-list(dense)
template(v-for='item in menu')
v-list-group(v-if='item.items', v-bind:group='item.group')
v-list-tile(:href='item.href', slot='item', :title="item.title")
v-list-tile-action
v-icon(:light="dark") {{ item.icon }}
v-list-tile-content
v-list-tile-title {{ $t(item.title) }}
v-list-tile-action
v-icon(:light="dark") keyboard_arrow_down
v-list-item(v-for='subItem in item.items', :key='subItem.href')
v-list-tile(:href='subItem.href', v-bind:router='!subItem.target', ripple, v-bind:disabled='subItem.disabled', v-bind:target='subItem.target')
v-list-tile-action(v-if='subItem.icon')
v-icon.success--text {{ subItem.icon }}
v-list-tile-content
v-list-tile-title {{ $t(subItem.title) }}
v-subheader(v-else-if='item.header', :light="dark") {{ item.header }}
v-divider(v-else-if='item.divider')
v-list-item(v-else)
v-list-tile(:href='item.href', router, ripple, v-bind:disabled='item.disabled', :title="item.title")
v-list-tile-action
v-icon(:light="dark") {{ item.icon }}
v-list-tile-content
v-list-tile-title {{ $t(item.title) }}
v-list-tile-action(v-if='item.subAction')
v-icon.success--text {{ item.subAction }}
v-toolbar.darken-1(fixed,light,:class="theme")
v-toolbar-side-icon(light, @click.native.stop='drawer = !drawer')
v-toolbar-title {{$t(pageTitle)}}
v-spacer
v-menu(offset-y)
v-btn(icon, light, slot="activator")
v-icon(light) language
v-list
v-list-item(v-for="lang in locales")
v-list-tile(@mouseover.native="changeLocale(lang)")
v-list-tile-title {{lang}}
v-menu(offset-y)
v-btn(icon, light, slot="activator")
v-icon(light) format_paint
v-list
v-list-item(v-for="n in colors")
v-list-tile(:class="n",@mouseover.native="theme = n")
main
v-container.pa-4(fluid)
v-alert(v-bind='message', v-model='message.body', dismissible) {{message.body}}
.py-2
v-slide-y-transition(mode='out-in')
router-view
</template>
<script>
import { mapState } from 'vuex'
export default {
data () {
return {
dark: true,
theme: 'primary',
mini: false,
drawer: true,
locales: ['en-US', 'zh-CN'],
colors: ['blue', 'green', 'purple', 'red']
}
},
computed: {
...mapState(['message', 'menu', 'pageTitle'])
},
methods: {
changeLocale (to) {
global.helper.ls.set('locale', to)
this.$i18n.locale = to
},
fetchMenu () {
// fetch menu from server
// this.$http.get('menu').then(({data}) => this.$store.commit('setMenu', data))
}
},
created () {
this.fetchMenu()
}
}
</script>