feat: 导航混合

Former-commit-id: 5942884a809813c87b6e49cefd4343aa07169b91
This commit is contained in:
april
2023-08-14 18:20:51 +08:00
parent c471f3c68b
commit 52a5d064a5
6 changed files with 287 additions and 47 deletions

View File

@@ -0,0 +1,41 @@
<script lang="ts" setup>
import { useRoute } from "vue-router";
import SidebarItem from "./SidebarItem.vue";
import { useSettingsStore } from "@/store/modules/settings";
import { useAppStore } from "@/store/modules/app";
import variables from "@/styles/variables.module.scss";
const settingsStore = useSettingsStore();
const appStore = useAppStore();
const currRoute = useRoute();
const layout = computed(() => settingsStore.layout);
const props = defineProps({
menuList: {
required: true,
default: () => {
return [];
},
type: Array<any>,
},
});
</script>
<template>
<el-menu
:default-active="layout === 'top' ? '-' : currRoute.path"
:collapse="!appStore.sidebar.opened"
:background-color="variables.menuBg"
:text-color="variables.menuText"
:active-text-color="variables.menuActiveText"
:unique-opened="false"
:collapse-transition="false"
:mode="layout === 'top' ? 'horizontal' : 'vertical'"
>
<sidebar-item
v-for="route in menuList"
:key="route.path"
:item="route"
:base-path="route.path"
:is-collapse="!appStore.sidebar.opened"
/>
</el-menu>
</template>