Blame view
src/components/pageHeader/AppDrawer.vue
7.21 KB
93a68cfa1
|
1 2 3 4 5 6 7 8 9 |
<template> <v-navigation-drawer id="appDrawer" :mini-variant.sync="mini" fixed :dark="$vuetify.dark" app v-model="drawer" width="260" |
687e0b929
|
10 11 12 13 |
> <v-toolbar class="fixcolors"> <img v-bind:src="computeLogo" height="40" width="150" class="imgLogo" alt="ana" /> <v-toolbar-title class="ml-0 pl-3"></v-toolbar-title> |
93a68cfa1
|
14 15 16 17 |
</v-toolbar> <vue-perfect-scrollbar class="drawer-menu--scroll" :settings="scrollSettings"> <v-list dense expand> <template v-for="(item, i) in menus"> |
687e0b929
|
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
<!--group with subitems--> <v-list-group v-if="item.items" :key="item.name" :group="item.group" no-action="no-action" > <v-list-tile slot="activator" ripple="ripple"> <v-list-tile-action v-if="item.icon" class="pr-3"> <img :src="item.icon" width="40" alt="icons" /> </v-list-tile-action> <v-list-tile-content> <v-list-tile-title>{{ item.title }}</v-list-tile-title> </v-list-tile-content> </v-list-tile> <template v-for="(subItem, i) in item.items"> <!--sub group--> <v-list-group v-if="subItem.items" :key="subItem.name" :group="subItem.group" sub-group="sub-group" > <v-list-tile slot="activator" ripple="ripple"> |
93a68cfa1
|
42 |
<v-list-tile-content> |
687e0b929
|
43 |
<v-list-tile-title>{{ subItem.title }}</v-list-tile-title> |
93a68cfa1
|
44 |
</v-list-tile-content> |
93a68cfa1
|
45 |
</v-list-tile> |
687e0b929
|
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 |
<v-list-tile v-for="(grand, i) in subItem.children" :key="i" :to="genChildTarget(item, grand)" :href="grand.href" ripple="ripple" > <v-list-tile-content> <v-list-tile-title>{{ grand.title }}</v-list-tile-title> </v-list-tile-content> </v-list-tile> </v-list-group> <!--child item--> <v-list-tile v-else :key="i" :to="genChildTarget(item, subItem)" :href="subItem.href" :disabled="subItem.disabled" :target="subItem.target" ripple="ripple" > <v-list-tile-action v-if="subItem.action"> <img width="30" :src="subItem.action" :class="[subItem.actionClass || 'success--text']" /> </v-list-tile-action> <v-list-tile-content> <v-list-tile-title class="body-2"> <span>{{ subItem.title }}</span> </v-list-tile-title> </v-list-tile-content> <!-- <v-circle class="white--text pa-0 circle-pill" v-if="subItem.badge" color="red" disabled="disabled">{{ subItem.badge }}</v-circle> --> </v-list-tile> </template> </v-list-group> <v-subheader v-else-if="item.header" :key="i">{{ item.header }}</v-subheader> <v-divider v-else-if="item.divider" :key="i"></v-divider> <!--top-level link--> <v-list-tile v-else ripple="ripple" :disabled="item.disabled" :target="item.target" rel="noopener" :key="item.path" > <a :href="item.path"> |
93a68cfa1
|
96 |
<v-list-tile-action v-if="item.icon"> |
687e0b929
|
97 |
<img :src="item.icon" width="40" alt="icons" /> |
93a68cfa1
|
98 |
</v-list-tile-action> |
687e0b929
|
99 |
<v-list-tile-content class="pl-3 mt-2"> |
93a68cfa1
|
100 101 102 103 |
<v-list-tile-title>{{ item.title }}</v-list-tile-title> </v-list-tile-content> <!-- <v-circle class="white--text pa-0 chip--x-small" v-if="item.badge" :color="item.color || 'primary'" disabled="disabled">{{ item.badge }}</v-circle> --> <v-list-tile-action v-if="item.subAction"> |
687e0b929
|
104 105 |
<!-- <v-icon class="success--text">{{ item.subAction }}</v-icon> --> <img :src="item.icon" width="40" alt="icons" /> |
93a68cfa1
|
106 107 |
</v-list-tile-action> <!-- <v-circle class="caption blue lighten-2 white--text mx-0" v-else-if="item.chip" label="label" small="small">{{ item.chip }}</v-circle> --> |
687e0b929
|
108 109 |
</a> </v-list-tile> |
93a68cfa1
|
110 |
</template> |
687e0b929
|
111 112 |
</v-list> </vue-perfect-scrollbar> |
93a68cfa1
|
113 114 115 |
</v-navigation-drawer> </template> <script> |
687e0b929
|
116 117 |
import menu from "@/api/menu"; import VuePerfectScrollbar from "vue-perfect-scrollbar"; |
93a68cfa1
|
118 |
export default { |
687e0b929
|
119 |
name: "app-drawer", |
93a68cfa1
|
120 |
components: { |
687e0b929
|
121 |
VuePerfectScrollbar |
93a68cfa1
|
122 123 124 125 126 |
}, props: { expanded: { type: Boolean, default: true |
687e0b929
|
127 |
} |
93a68cfa1
|
128 129 130 131 |
}, data: () => ({ mini: false, drawer: true, |
37150e7c1
|
132 |
menus: [], |
93a68cfa1
|
133 134 |
scrollSettings: { maxScrollbarLength: 160 |
687e0b929
|
135 |
} |
93a68cfa1
|
136 137 |
}), computed: { |
687e0b929
|
138 |
computeGroupActive() { |
93a68cfa1
|
139 140 |
return true; }, |
687e0b929
|
141 142 |
computeLogo() { return "/static/logoIntrack.png"; |
55f72b7d7
|
143 |
}, |
93a68cfa1
|
144 |
|
687e0b929
|
145 |
sideToolbarColor() { |
93a68cfa1
|
146 |
return this.$vuetify.options.extra.sideNav; |
687e0b929
|
147 |
} |
93a68cfa1
|
148 |
}, |
687e0b929
|
149 |
created() { |
37150e7c1
|
150 151 152 153 |
if (this.$store.state.role === "ADMIN") { this.menus = menu.adminMenu; } else if (this.$store.state.role === "SUPERADMIN") { this.menus = menu.schoolMenu; |
99cd79184
|
154 155 156 157 |
} else if (this.$store.state.role === "LIBRARIAN") { this.menus = menu.libraryMenu; } else if (this.$store.state.role === "ACCOUNTANT") { this.menus = menu.accountMenu; |
37150e7c1
|
158 |
} |
687e0b929
|
159 160 |
window.getApp.$on("APP_DRAWER_TOGGLED", () => { this.drawer = !this.drawer; |
93a68cfa1
|
161 162 |
}); }, |
93a68cfa1
|
163 164 |
methods: { |
687e0b929
|
165 |
genChildTarget(item, subItem) { |
93a68cfa1
|
166 167 168 |
if (subItem.href) return; if (subItem.component) { return { |
687e0b929
|
169 |
name: subItem.component |
93a68cfa1
|
170 171 |
}; } |
687e0b929
|
172 173 |
return { name: `${item.group}/${subItem.name}` }; } |
93a68cfa1
|
174 175 176 177 178 179 180 |
} }; </script> <style lang="stylus"> // @import '../../node_modules/vuetify/src/stylus/settings/_elevations.styl'; |
687e0b929
|
181 182 |
#appDrawer { overflow: hidden; |
93a68cfa1
|
183 |
|
687e0b929
|
184 185 186 187 188 |
.drawer-menu--scroll { height: calc(100vh - 48px); overflow: auto; } } |
37150e7c1
|
189 |
|
687e0b929
|
190 |
.v-list__group__items--no-action .v-list__tile { |
37150e7c1
|
191 |
padding-left: 72px !important; |
687e0b929
|
192 |
} |
37150e7c1
|
193 |
|
03dcbf0c1
|
194 |
.v-list--dense .v-list__tile:not(.v-list__tile--avatar) { |
687e0b929
|
195 196 |
height: 60px; font-size: 17px; |
03dcbf0c1
|
197 |
} |
687e0b929
|
198 |
|
03dcbf0c1
|
199 |
.v-list__tile__action { |
687e0b929
|
200 |
min-width: 36px; |
03dcbf0c1
|
201 |
} |
687e0b929
|
202 203 204 205 206 |
.v-list__tile.primary--text a { color: black !important; border-left: 4px solid black; border-radius: 4px; |
03dcbf0c1
|
207 |
} |
687e0b929
|
208 209 210 |
@media screen and (max-width: 420px) { .v-list--dense .v-list__tile:not(.v-list__tile--avatar) { |
03dcbf0c1
|
211 |
font-size: 14px; |
687e0b929
|
212 213 214 215 216 217 |
} .imgLogo { height: 32px; width: 120px; } |
03dcbf0c1
|
218 |
} |
93a68cfa1
|
219 |
</style> |
d75967ec2
|
220 221 222 |
<style scoped> |
687e0b929
|
223 224 225 |
.theme--light .v-icon, .application .theme--light.v-icon { color: #39b982; |
d75967ec2
|
226 |
} |
687e0b929
|
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
a { text-decoration: none; display: inherit; color: black; } a:hover { color: gray !important; /* border-left: 4px solid black; */ /* border-radius: 4px; */ } /* a:active { color: red !important; } */ /* a:visited { border-left: 4px solid black; border-radius: 4px; } */ /* visited link */ /* a:visited { color: black !important; border-left: 4px solid black; border-radius: 4px; } a:active { color: black !important; border-left: 4px solid black; border-radius: 4px; } */ |
d75967ec2
|
255 |
</style> |