refactor: ♻️ 导航栏组件代码重构优化

This commit is contained in:
ray
2024-10-30 00:32:50 +08:00
parent 9d9b0eb035
commit a2fd2b0e75
10 changed files with 227 additions and 182 deletions

View File

@@ -1,15 +1,13 @@
<template>
<div class="navbar-container">
<!-- 导航栏面包屑 -->
<div class="flex">
<hamburger
:is-active="appStore.sidebar.opened"
@toggle-click="toggleSideBar"
/>
<div class="navbar">
<div class="navbar__left">
<!-- 展开/收缩菜单 -->
<Hamburger :is-active="isSidebarOpened" @toggle-click="toggleSideBar" />
<!-- 面包屑 -->
<breadcrumb />
</div>
<!-- 导航栏右侧 -->
<NavbarAction />
<NavbarRight />
</div>
</template>
@@ -18,16 +16,25 @@ import { useAppStore } from "@/store";
const appStore = useAppStore();
// 侧边栏是否打开
const isSidebarOpened = computed(() => appStore.sidebar.opened);
// 展开/收缩菜单
function toggleSideBar() {
appStore.toggleSidebar();
}
</script>
<style lang="scss" scoped>
.navbar-container {
@apply flex-x-between;
.navbar {
display: flex;
justify-content: space-between;
height: $navbar-height;
background: var(--el-bg-color);
&__left {
display: flex;
align-items: center;
}
}
</style>