Files
Yi.Admin/Yi.Vue/src/layouts/default/Drawer.vue

174 lines
3.6 KiB
Vue
Raw Normal View History

2021-10-11 15:45:59 +08:00
<template>
<v-navigation-drawer
id="default-drawer"
2021-10-16 21:28:28 +08:00
v-model="$store.state.home.drawer"
2021-10-11 15:45:59 +08:00
:dark="dark"
:right="$vuetify.rtl"
2021-10-16 21:28:28 +08:00
:src="$store.state.home.drawerImage ? image : ''"
:mini-variant.sync="$store.state.home.mini"
2021-10-11 15:45:59 +08:00
mini-variant-width="80"
app
width="260"
>
2021-10-16 21:28:28 +08:00
<template v-if="$store.state.home.drawerImage" #img="props">
<v-img :key="image" :gradient="gradient" v-bind="props" />
2021-10-11 15:45:59 +08:00
</template>
<div class="px-2">
<default-drawer-header />
<v-divider class="mx-3 mb-2" />
<default-list :items="items" />
</div>
<template #append>
<div class="pa-4 text-center">
<app-btn
class="text-none mb-4"
color="white"
href="https://vuetifyjs.com"
small
text
>
Documentation
</app-btn>
2021-10-16 21:28:28 +08:00
<app-btn block class="text-none" color="secondary" @click="logout">
<v-icon left> mdi-package-up </v-icon>
2021-10-11 15:45:59 +08:00
2021-10-16 15:18:41 +08:00
退出
2021-10-11 15:45:59 +08:00
</app-btn>
</div>
</template>
<div class="pt-12" />
</v-navigation-drawer>
</template>
<script>
2021-10-16 21:28:28 +08:00
// Utilities
// import { get, sync } from 'vuex-pathify'
export default {
methods: {
logout() {
this.$store.dispatch("Logout").then((resp) => {
this.$router.push({ path: "/login" });
});
},
},
data: () => ({
image:
"https://demos.creative-tim.com/material-dashboard-pro/assets/img/sidebar-1.jpg",
2021-10-13 17:44:42 +08:00
2021-10-16 21:28:28 +08:00
gradient: "rgba(228, 226, 226, 1), rgba(255, 255, 255, 0.7)",
2021-10-13 17:44:42 +08:00
2021-10-16 21:28:28 +08:00
dark: null,
2021-10-13 17:44:42 +08:00
2021-10-16 21:28:28 +08:00
items: [
2021-10-11 15:45:59 +08:00
{
2021-10-11 21:50:50 +08:00
title: "首页",
2021-10-11 15:45:59 +08:00
icon: "mdi-view-dashboard",
2021-10-16 21:28:28 +08:00
to: "/",
2021-10-11 15:45:59 +08:00
},
{
2021-10-13 17:44:42 +08:00
title: "用户角色管理",
2021-10-11 15:45:59 +08:00
icon: "mdi-account",
2021-10-13 17:44:42 +08:00
to: "",
2021-10-16 21:28:28 +08:00
children: [
{
title: "用户管理",
icon: "mdi-account",
to: "/admuser/",
children: [],
},
{
title: "角色管理",
icon: "mdi-account",
to: "/admrole/",
children: [],
},
],
2021-10-11 15:45:59 +08:00
},
{
2021-10-13 17:44:42 +08:00
title: "菜单接口管理",
2021-10-11 15:45:59 +08:00
icon: "mdi-clipboard-outline",
2021-10-13 17:44:42 +08:00
to: "",
2021-10-16 21:28:28 +08:00
children: [
{
title: "菜单管理",
icon: "mdi-account",
to: "/admMenu/",
children: [],
},
{
title: "接口管理",
icon: "mdi-account",
to: "/admMould/",
children: [],
},
{
title: "角色菜单分配管理",
icon: "mdi-account",
to: "/admRoleMenu/",
children: [],
},
],
2021-10-11 15:45:59 +08:00
},
],
2021-10-16 21:28:28 +08:00
}),
name: "DefaultDrawer",
2021-10-11 15:45:59 +08:00
2021-10-16 21:28:28 +08:00
components: {
DefaultDrawerHeader: () =>
import(
2021-10-11 15:45:59 +08:00
/* webpackChunkName: "default-drawer-header" */
2021-10-16 21:28:28 +08:00
"./widgets/DrawerHeader"
2021-10-11 15:45:59 +08:00
),
2021-10-16 21:28:28 +08:00
DefaultList: () =>
import(
2021-10-11 15:45:59 +08:00
/* webpackChunkName: "default-list" */
2021-10-16 21:28:28 +08:00
"./List"
2021-10-11 15:45:59 +08:00
),
2021-10-16 21:28:28 +08:00
},
// computed: {
// ...get('user', [
// 'dark',
// 'gradient',
// 'image',
// ]),
// ...get('app', [
// 'items',
// 'version',
// ]),
// ...sync('app', [
// 'drawer',
// 'drawerImage',
// 'mini',
// ]),
// },
};
2021-10-11 15:45:59 +08:00
</script>
<style lang="sass">
#default-drawer
.v-list-item
margin-bottom: 8px
.v-list-item::before,
.v-list-item::after
display: none
.v-list-group__header__prepend-icon,
.v-list-item__icon
margin-top: 12px
margin-bottom: 12px
margin-left: 4px
&.v-navigation-drawer--mini-variant
.v-list-item
justify-content: flex-start !important
</style>